• Android——Activity练习


    manifests里的AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.chenshuai.test">
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <!--谁在前启动谁-->
            <activity android:name=".Axtivity2">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
    
    
            </activity>
    
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
    
        </application>
    
    </manifest>

    layout里新建的layoutactivity.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="1">
    
        <!--匹配父窗口  match_parent
            包裹内容    wrap_content-->
        <TextClock
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
    
           android:text="大家好吗?"
    
    
          />
    
    </LinearLayout>

    java里新建的Activity2

    package com.example.chenshuai.test;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    
    /**
     * Created by chenshuai on 2016/3/16.
     */
    public class Axtivity2 extends Activity {
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
    
            super.onCreate(savedInstanceState);
    
            setContentView(R.layout.layoutactivity);
    
            System.out.println("这是我运行的第一个Activity");
    
            //输出日志
            Log.d("test","Log输出的信息");
    
            Log.w("test","Log输出的信息");//warning 蓝色
    
            Log.e("test","Log输出的信息");//eror 红色
    
            Log.i("test","Log输出的信息");
    
            Log.v("test","Log输出的信息");
    
        }
    }

  • 相关阅读:
    JavaScript中split() 使用方法
    解决elementui中table表格rowstyle改变当前行样式
    vue项目中使用$.once(‘hook:beforeDestory‘,() => {})清理定时器问题
    js中split()方法和join()方法
    前端报各种提示错误400 等
    Linux 网络编程Socket
    C 语言数组名
    Checksum
    Gcc 编译过程
    Nodejs爬取壁纸接口数据
  • 原文地址:https://www.cnblogs.com/Chenshuai7/p/5285845.html
Copyright © 2020-2023  润新知