我想改变我的动作条的文本的颜色,它不工作 [英] I want to change the color of the text of my ActionBar, it's not working
本文介绍了我想改变我的动作条的文本的颜色,它不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能够改变操作栏的文本的颜色,背景色工作正常,但不是文本的颜色。
<样式名称=MyTheme的父=@安卓风格/ Theme.Holo.Light>
<项目名称=机器人:actionBarStyle> @风格/ MyActionBar< /项目>
<项目名称=机器人:titleTextStyle> @风格/ myTheme.ActionBar.Text< /项目>
< /风格>
<样式名称=MyActionBar父=@安卓风格/ Widget.Holo.Light.ActionBar>
<项目名称=机器人:背景>#0E2F44< /项目>
< /风格>
<样式名称=myTheme.ActionBar.Text父=@安卓风格/ TextAppearance>
<项目名称=机器人:文字颜色> @色/ actionBarText< /项目>
< /风格>
这里是明显的:
<使用-SDK
安卓的minSdkVersion =14
机器人:targetSdkVersion =21/>
解决方案
你为什么不以编程方式做到这一点
随机RND =新的随机();
ToolBar.setTitleTextColor(Color.argb(255,rnd.nextInt(256),rnd.nextInt(256),rnd.nextInt(256)));
其实这集的随机颜色。
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" />
解决方案
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..
这篇关于我想改变我的动作条的文本的颜色,它不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文