-1

My application have activities and am not using support library. But I would like to change the colorPrimaryDark of a class which extends Activity(not AppCompat).

I have used below code in my style.xml and changed actionBar color

<style name="MyTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@color/colorPrimary</item>
</style>

Now, my activity's actionBar look like below

this

But I want it to look something like this,

this

Someone's help is appreciated. Thanks.

Shree
  • 354
  • 2
  • 21

2 Answers2

0

Top bar is known as status bar so adding the below code to your theme should work.

<item name="android:statusBarColor">@color/your_color</item>
Vivek Mishra
  • 5,669
  • 9
  • 46
  • 84
0

Here is the solution after trying many things. Use any of Material Theme as parent with android:colorPrimaryDark as below

<style name="MyTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
     <item name="android:actionBarStyle">@style/MyActionBar</item>
     <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
     <item name="android:background">@color/colorPrimary</item>
</style>
Shree
  • 354
  • 2
  • 21