如何设置我的活动在android的主要活动?我的、如何设置、android

2023-09-12 05:02:44 作者:扼杀谎言Gun∫

我想创建自己的活动为使用默认的主要活动主要活动,而不是,我怎么可以定义在Android清单?在此先感谢...

i want to create own activity as main activity rather than using default main activity, how can i define that in android manifest? Thanks in advance...

推荐答案

在你的清单文件,请使用以下code申报活动为发射活动:

In your manifest file , use the below code to declare an activity as a launcher activity:

<activity android:name=".yourActivityName" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

从Android开发者文档:

From Android Developer docs:

ACTION_MAIN活性:启动作为任务的初始活性,没有数据输入并且没有返回的输出

ACTION_MAIN activity: Start up as the initial activity of a task, with no data input and no returned output.

CATEGORY_LAUNCHER:该活动可以是任务的初始活性和列在顶层应用程序launcher`

CATEGORY_LAUNCHER: The activity can be the initial activity of a task and is listed in the top-level application launcher`.