Shakeeb Ayaz
Shakeeb Ayaz

Reputation: 6096

How to add theme to an activity other then default

I have a default theme which i defined in AndroidManifest.xml under application tag. For all the activity I want the same theme but one of the activity i want different theme.

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppStyle">

<activity android:name="ActivityA"></activity>

<activity android:name="ActivityB"></activity>

<activity android:name="ActivityC"></activity>

<activity android:name="ActivityD"></activity>

ActivityD I want theme other than default theme.

Upvotes: 1

Views: 949

Answers (1)

Ahmad
Ahmad

Reputation: 72533

You can just override the theme:

<activity android:name="ActivityD" android:theme="@style/some_other_style"></activity>

Now ActivityD will use an other style than the one declared in the application tag.

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppStyle">

<activity android:name="ActivityA"></activity>

<activity android:name="ActivityB"></activity>

<activity android:name="ActivityC"></activity>

<activity android:name="ActivityD" android:theme="@style/some_other_style"></activity>

Upvotes: 2

Related Questions