- 在xml 设计页面添加标签
<?
xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.app_style.MainActivity"
android:orientation="vertical">
<Button
android:id="@+id/b1"
android:text="click select!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/b2"
android:text="click Dx!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
2
/**
* Created by Administrator on 2017/1/3.
* 四大组件都需要注册-》跳转
*/
public class One extends AppCompatActivity {
// 顺序
// 正常
//
// On create -> 创建 Activity不可见
// On start -> 推出去 Activity可见
// On resume-> 用于暂停的回调Activity
// On pause -> 暂停 Activity
// On stop -> OnDestory 销毁Activity结束
//↓ ↑ ← →
// Log →.d debug .e exception .i info
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timcopy);
Log.e("s","onCreate ->");
}
@Override
protected void onStart() {
super.onStart();
Log.e("s","onStart ->");
}
@Override
protected void onResume() {
super.onResume();
Log.e("s","onResume ->");
}
@Override
protected void onPause() {
super.onPause();
Log.e("s","onPause ->");
}
@Override
protected void onStop() {
super.onStop();
Log.e("s","onStop() ->");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.e("s","onDestroy()");
}
- 在xml 设计页面添加标签
<?
xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.app_style.MainActivity"
android:orientation="vertical">
<Button
android:id="@+id/b1"
android:text="click select!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/b2"
android:text="click Dx!"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
2
/**
* Created by Administrator on 2017/1/3.
* 四大组件都需要注册-》跳转
*/
public class One extends AppCompatActivity {
// 顺序
// 正常
//
// On create -> 创建 Activity不可见
// On start -> 推出去 Activity可见
// On resume-> 用于暂停的回调Activity
// On pause -> 暂停 Activity
// On stop -> OnDestory 销毁Activity结束
//↓ ↑ ← →
// Log →.d debug .e exception .i info
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timcopy);
Log.e("s","onCreate ->");
}
@Override
protected void onStart() {
super.onStart();
Log.e("s","onStart ->");
}
@Override
protected void onResume() {
super.onResume();
Log.e("s","onResume ->");
}
@Override
protected void onPause() {
super.onPause();
Log.e("s","onPause ->");
}
@Override
protected void onStop() {
super.onStop();
Log.e("s","onStop() ->");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.e("s","onDestroy()");
}