我想改变我的动作条的文本的颜色,它不工作我的、我想、它不、文本

2023-09-12 03:25:31 作者:爱而不得最心酸

我不能够改变操作栏的文本的颜色,背景色工作正常,但不是文本的颜色。

 <样式名称=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..