austin
austin

Reputation: 405

Android ActionBar Theme does not update

I am trying to Style my Android app through styles and I cannot get action bar to update.

I am using v7 support package all my activities extend AppCompatActivity.

The actionBar works. but I cannot seem to style it at all. When I try to set the background of the Application. I will end up changing the background of the Action Bar.

styles.xml

<style name="Bea_Theme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/Bea_Theme.ActionBar</item>
</style>

<style name="Bea_Theme.ActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:background">@color/colorPrimary</item>
    <item name="android:textColor">#FF0000</item>
</style>

AndroidManifest.xml

<application
    android:name=".CallBellApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Bea_Theme">
    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />

            <category android:name="com.example.gcm" />
        </intent-filter>
    </receiver>

    <service
        android:name=".service.CallBellGCMListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>
    <service
        android:name=".service.CallBellInstanceIdListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.gms.iid.InstanceID" />
        </intent-filter>
    </service>
    <service
        android:name=".service.RegistrationIntentService"
        android:exported="false" >
    </service>

    <activity
        android:name=".presentation.login.LoginActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.MONKEY" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <activity
        android:name=".presentation.bed.BedModeActivity"
        android:label="@string/title_activity_bed_mode">
    </activity>
    <activity android:name=".presentation.BaseActivity">

    </activity>
    <activity android:name=".presentation.station.StationActivity">
    </activity>
</application>

Results in just the plain old android applicationApplication Screenshot

Upvotes: 1

Views: 57

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 199825

You should be using colorPrimary directly in your theme to color your action bar as per this pro-tip:

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/primary</item>
</style>

Upvotes: 0

Related Questions