zoukankan      html  css  js  c++  java
  • 安卓——Activity生命周期、



    1. 在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()");
        }
      
    1. 在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()");
        }
      
  • 相关阅读:
    laravel-excel maatwebsite/excel 新版中文文档
    laravel-excel.com官网英文站
    composer查看镜像地址
    Navicat Premium 通过ssh 连接服务器
    Centos7 yum 出现could not retrieve mirrorlist 最终解决方案
    php 获取随机字符串算法
    apache 配置多域名访问的方法
    laravel 配置多域名最简单的方法
    es6知识点
    如何判断浏览器为ie10以上
  • 原文地址:https://www.cnblogs.com/embaobao/p/10720864.html
Copyright © 2011-2022 走看看