Frage

I've created the following xml files for applying style to my ActionBar, but It doens't work

<!-- Application theme. -->
<style name="AppTheme" parent="@style/Theme.AppCompat">
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:background">@color/actionbar_color</item>
    <item name="background">@color/actionbar_color</item>
    <!--<item name="actionModeBackground">@color/actionbar_color</item>-->
    <!-- Support library compatibility -->
    <!-- <item name="background">@drawable/actionbar_background</item> -->
</style>

And the Manifest

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

Where could be the problem, the action bar is shown black with the blue line below

War es hilfreich?

Lösung

Try to change to:

<style name="AppTheme" parent="@style/Theme.AppCompat">
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

And: I am not sure if @color is allowed in line <item name="background">@color...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top