1

I am trying to mimic the indigo pink and white colored style, as specified by Google here.

If I choose the parent theme as android:Theme.Material, then the background will be dark and text will be white. That led me to choose the parent app theme to be android:Theme.Material.Light.

However, now the items in ActionBar are colored black. I was able to style the text color back to white by

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

<style name="AppTheme.MyActionBar" parent="@android:style/Widget.Material.ActionBar">
    ...
    <item name="android:titleTextStyle">@style/AppTheme.MyActionBar.TitleTextStyle</item>
    ...
</style>

<style name="AppTheme.MyActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title">
    <item name="android:textColor">@android:color/white</item>
</style>

Now I need to override the color of the back button.

Unfortunately, specifying the parent of MyActionBar style as @android:style/Widget.Material.ActionBar (rather than @android:style/Widget.Material.Light.ActionBar) does not do the job.

This discussion How to customize the back button on ActionBar tells how to specify a resource via @drawable. Yet, I would like to use the back button from the dark theme using approach similar to styling text.

Is it possible to change the color of an ActionBar back button by somehow inheriting pre-existing style?

Thank you for your attention. enter image description here enter image description here

Community
  • 1
  • 1
user2551017
  • 153
  • 10

2 Answers2

1

Use android:Theme.Material.Light.DarkActionBar - this optimizes for a dark action bar - automatically giving you white icons and text.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
0

You can try this one:

<style name="Theme.MyFancyTheme" parent="android:Theme.Holo">
    <item name="android:homeAsUpIndicator">@drawable/my_fancy_up_indicator</item>
</style>
Lennon Spirlandelli
  • 3,131
  • 5
  • 26
  • 51
  • 1
    Thank you, but as I wrote, I am explicitly trying to avoid bringing external drawable resources to the project – user2551017 Apr 16 '15 at 21:34
  • So try to change `@drawable/my_fancy_up_indicator` to `@color/whatevercolor` – Lennon Spirlandelli Apr 16 '15 at 21:56
  • It will result in a square colored with whatevercolor, which is not what I want. – user2551017 Apr 16 '15 at 21:59
  • 2
    @user2551017 try `@drawable/abc_ic_ab_back_mtrl_am_alpha` which should be already available in android. so you wont be using external resource – Jemshit Apr 16 '15 at 22:07
  • since you are extending theme.material.light, this should mean light background, dark foreground. Which is your back button, overflow menu button should be black. So you need to overwrite it or change parent of your theme – Jemshit Apr 16 '15 at 22:35
  • Right, and I failed to achieve it by changing the parent of the ActionBar theme only, as shown in the snippet in the question – user2551017 Apr 16 '15 at 23:33