android - 如何更改上下文操作栏的文本颜色?安卓

标签 android android-actionbar contextual-action-bar

我在尝试更改上下文栏操作栏时遇到问题。所以我已经设置好它并且工作正常,但我似乎无法更改左上角的文本颜色。我为出租车设置了自定义主题,但没有帮助。

 <style name="Widget.ActionMode" parent="@android:style/Widget.Holo.Light.ActionMode">
        <item name="android:textColor">@android:color/white</item>
 </style>

我的 CAB 看起来与此链接中的类似,但出于某种原因,文本颜色(左上角)是黑色的。

http://androidperspective.files.wordpress.com/2013/04/nexus-4-flat.png

最佳答案

        Yes You can do that...

        For changing text color you have to follow steps...

      1) create XML file containing only Textview

     <?xml version="1.0" encoding="utf-8"?>
        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/contextualAB_Title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@android:color/white" />

        2)Now, replace following line of code with your code.

     Original : 
        mActionMode.setTitle(String.valueOf(mSelectedCount) + " selected");
        Replace with :
        TextView tv = (TextView) getLayoutInflater().inflate(R.layout.contextual_title, null);
        tv.setText("Contextual Action Bar");
mActionMode.setCustomView(tv);    

    You can replace your color with @android:color/white

关于android - 如何更改上下文操作栏的文本颜色?安卓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25272062/

相关文章:

android: 对话框,取消按钮

android - 设置 MenuItem onPressed Action Android Action 条?最好是程序化的

android - 从在actionbarstylegenerator上创建的操作栏更改应用程序的标题颜色

android - 长按后如何选择ListView项目?

android - 带有 DialogFragment 的上下文操作栏

Android 以编程方式获取设备名称(s2,s3)

android - 如何在Android的build.gradle的预构建中执行.app程序(文件)

android - 如何将 Android 应用的翻译说明上传到开发人员控制台?

android - 更改自定义操作栏标题

android - 如何突出显示或检查选定的列表项