Lollipop Theme issue

情到浓时终转凉″ 提交于 2020-01-24 11:43:38

问题


I am using sherlock action bar in my project, I have used Theme.Sherlock.Light.DarkActionBar

   <style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="android:homeAsUpIndicator">@drawable/transparent</item>
    <item name="homeAsUpIndicator">@drawable/transparent</item>
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:titleTextStyle">@style/Widget.MyTheme.TitleTextStyle</item>
    <item name="android:textAllCaps">false</item>   
    </style>

Problem : I am getting light color menu with lollipop:

pre lollipop image :

Lollipop image :

can some one guide me, how can I get slimier menu color on both .


回答1:


You can create a style which extends from actionbar sherlock to change color of you actionbar with other properties.

<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">#ff000000</item>
    <item name="background">#ff000000</item>
    <item name="android:textColor">#CC3232</item>
</style>

For TextColor only

<style name="YOURTHEME.ActionBar.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
        <item name="android:textColor">@color/yourColor</item>
        <item name="textColor">@color/yourColor</item>
</style>

Last resort Solution

<item name="android:textColorPrimary">@color/yourColor</item>



回答2:


You should create a new styles.xml in a separate values-21 folder. There, you can define a specific theme/style that suits your needs for Lollipop devices only.




回答3:


You should be using the ActionBar or ToolBar provided by app-compat library, instead of ActionBarSherlock.

ABS uses replacement Holo themes for older versions, which I guess hasn't been updated in a while.



来源:https://stackoverflow.com/questions/27614962/lollipop-theme-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!