Android-Activity

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 3     package="com.hanqi.myapplication">
 4 
 5     <application
 6         android:allowBackup="true"
 7         android:icon="@mipmap/ic_launcher"
 8         android:label="@string/app_name"
 9         android:supportsRtl="true"
10         android:theme="@style/AppTheme">
11 
12         <activity
13             android:name=".TestActivity1">
14             <intent-filter>
15                 <action android:name="android.intent.action.MAIN"/>
16                     <category android:name="android.intent.category.LAUNCHER"/>
17             </intent-filter>
18         </activity>
19
</application>
20 <manifest/>
 

 

 1 package com.hanqi.myapplication;
 2 
 3 import android.app.Activity;
 4 import android.os.Bundle;
 5 //1.继承Activity
 6 /**
 7  * Created by Administrator on 2016/04/22.
 8  */
 9 public class TestActivity1 extends Activity{
10 
11     //2.重写onCreate(),关联layout文件
12         //onCreate()回调方法:在满足特定条件下自动调用的方法;方法名一般On开头
13 
14     @Override
15     protected void onCreate(Bundle savedInstanceState) {
16         super.onCreate(savedInstanceState); //右键单击覆盖方法选择onCreate方法.
17         //关联
18         setContentView(R.layout.message_linearlayout);
19     }
20 }

 

posted @ 2016-04-22 19:07  宫崎天川  阅读(218)  评论(0编辑  收藏  举报