I want to change the color of the text of my ActionBar, it's not working

北城以北 提交于 2019-12-13 03:04:50

问题


I'm not able to change the color of the text of the action bar, the color of the background is working fine, but not the color of the text.

     <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#0E2F44</item>
</style>

  <style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
    <item name="android:textColor">@color/actionBarText</item>
</style>

here is the manifest :

 <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

回答1:


why don't you do it programmatically

Random rnd = new Random(); 
ToolBar.setTitleTextColor(Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));

actually this set's a random colour..



来源:https://stackoverflow.com/questions/28269471/i-want-to-change-the-color-of-the-text-of-my-actionbar-its-not-working

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