android activity入口指定与更改(即启动acitivity的设置与更换)

时间:2025-01-19 17:58:31
为了测试每个Activity的显示效果是否达成要求,想直接启动就显示新设计的Activity,就需要更改Android程序的入口Activity,主要修改文件即可,

原如下:
<manifest package=""
    android:versionCode="1"
    android:versionName="1.0" xmlns:andro>

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >     
         <activity
            android:name=".RelativeActivity"
            android:label="@string/title_activity_relative" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity> 

        <activity
            android:name=".FrameActivity"
            android:label="@string/title_activity_frame" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity>
      
    </application>

</manifest>

此时 RelativeActivity为启动界面。
要修改.FrameActivity为启动界面,只需要将.FrameActivity往前放即可,结果如下:

<manifest package=""
    android:versionCode="1"
    android:versionName="1.0" xmlns:andro>

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" > 
        <activity
            android:name=".FrameActivity"
            android:label="@string/title_activity_frame" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity>   

        <activity
            android:name=".RelativeActivity"
            android:label="@string/title_activity_relative" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity>     
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="" />

                <category android:name="" />
            </intent-filter>
        </activity>      
    </application>

</manifest>


转载自:[喝小酒的网摘]/a/