Android manifest.xml

2019-04-10 15:46发布

I'm working on the Tabs example from Google Android Developers site (http://developer.android.com/resources/tutorials/views/hello-tabwidget.html) but I'm stuck in step 2.

At the very end of step 2 says "Duplicate this for each of the three activities, and add the corresponding tags to the Android Manifest file"

What exactly do I have to add to the AndroidManifest.xml?

Thanks

4条回答
Melony?
2楼-- · 2019-04-10 16:07

Basically you have register each activities in AndroidManifest.xml like this

<activity android:name=".YourActivityName"/>
查看更多
劳资没心,怎么记你
3楼-- · 2019-04-10 16:09

This is how your Manifest file should be:

    <activity android:name=".ArtistsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <activity android:name=".SongsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <activity android:name=".AlbumsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

</application>

This will work for sure!!

查看更多
聊天终结者
4楼-- · 2019-04-10 16:25

just add every activity AndroidManifest.xml

main activity use:
<activity android:name=".Tabs">
<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
another activity use:
 <activity android:name=".Tab1">
     <intent-filter>
              <action android:name="android.intent.action.EDIT"/>
              <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
     </activity>
查看更多
Lonely孤独者°
5楼-- · 2019-04-10 16:27

You have to add the corresponding <activity> tags for each one of the three activities. The AndroidManifest.xml file describes the components of the application (amongst other things like permissions and API level support).

In this example you have to add three definitions:

<activity android:name=".ArtistsActivity"/>
<activity android:name=".AlbumsActivity"/>
<activity android:name=".SongsActivity"/>
查看更多
登录 后发表回答