If i have specified my Theme for the application such as so:
<application
android:name="main_application.GlobalObjects"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
Do I then need to specify the Theme again for each activity defined in the manifest file like so:
<activity
android:name="main_application.MainActivity"
android:label="@string/app_name" >
android:theme="@style/AppTheme" >
</activity>
Or do i only need to do this when over riding the applications theme for a single activity?
Do I then need to specify the Theme again for each activity defined in the manifest file like so
No, Once you have defined the Theme
for the application and applied it in manifest <application>
tag then there is not need of specifying Theme
for each Activity
again.
But if you want different Themes for each activity then in this case you can define separate themes for each activity.
Do I then need to specify the Theme again for each activity defined in the manifest file like so
No. If you need a specific Theme
for a particular Activity
then you can set it on the Activity
. Otherwise just set it on the <application>
If you want to use same theme all over the application then setting theme in application tag in manifest is good enough. For example, this part of your code
<application
android:name="main_application.GlobalObjects"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
But if you want to use different theme in different activities then you have to specify the theme like your code
<activity
android:name="main_application.MainActivity"
android:label="@string/app_name"
android:theme="@style/ThemeForThisActivity" />
If you need different theme for each of your activity then YES. If you need same theme for your application then NO.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.