• android 26 设置项目有多个入口Activity。


    第一个activity

    package com.sxt.day04_11;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
    }

    第二个activity

    package com.sxt.day04_11;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    
    public class SecondActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_second);
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.second, menu);
            return true;
        }
    
    }

    系统描述文件:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.sxt.day04_11"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="18" />
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            项目有2个入口
            <activity
                android:name="com.sxt.day04_11.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                android:name="com.sxt.day04_11.SecondActivity"
                android:label="@string/title_activity_second" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
  • 相关阅读:
    SQL注入(手工篇)
    sed命令
    交互输入与for语句
    编程原理
    grep与正则表达式
    重定向和管道符
    shell_oneday_历史命令相关
    python_01_初识python
    C# 上传文件
    C# in 参数化处理 (记)
  • 原文地址:https://www.cnblogs.com/yaowen/p/4886827.html
Copyright © 2020-2023  润新知