Brent Hronik
Brent Hronik

Reputation: 2427

Inheriting from Theme.AppCompat*

Currently working on migrating to ActionBar in the support libraries. Currently trying to migrate my old themes to inherit from Theme.AppCompat.Light.DarkActionBar but it isn't going very smoothly.

It is fine if I apply the theme in the manifest as such:

<activity
    android:name="com.fitsby.LoginActivity"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light.DarkActionBar" >
</activity>

But I get a runtime error, stating that LoginActivity(subclass of ActionBarActivity) must have a theme which inherits from Theme.AppCompat, when I do the following: in styles.xml:

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:typeface">sans</item>   
</style> 

and in the manifest:

<activity
    android:name="com.fitsby.LoginActivity"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme" >
</activity>

Any ideas why that is happening? I do not see a problem, since AppTheme clearly inherits from one of the AppCompat Themes.

Upvotes: 9

Views: 7423

Answers (1)

user
user

Reputation: 87064

If you have different values folder in your application, for different API levels, make sure that each of those themes from the folders extend from the required Theme.AppCompat.* themes.

Upvotes: 10

Related Questions