How to change the text color in Android Action bar

后端 未结 5 978
迷失自我
迷失自我 2021-01-23 00:04

Hello I need help on changing the text color of the action Bar the following is my style.xml.I need to change the text color to white including the settings icon.



        
相关标签:
5条回答
  • 2021-01-23 00:18

    You can simply put color to your strings like this:

    <string name="app_name"><![CDATA[<b><font color=#FFFFFF>yebo</b>]]></string>
    
    0 讨论(0)
  • 2021-01-23 00:25

    try this

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
      <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
      </style>
    
      <style name="MyTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
      </style>
    
      <style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@color/red</item>
      </style>
    </resources>
    
    0 讨论(0)
  • 2021-01-23 00:31

    Change in your style.

     <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    

    Add underneath line:

        <item name="actionMenuTextColor">Your Color Here</item>
        <item name="textColorPrimary">Your Color Here</item>
    </style>
    

    Hope it helps.

    0 讨论(0)
  • 2021-01-23 00:32

    In your .axml put a RelativeLayout to add the actionbar. In here add a TextView with the property android:textColor="#FFFFFF". (#FFFFFF is white). As such:

    <RelativeLayout
        android:id="@+id/titleBarLinearLayoutFrontPage"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="55dp"
        android:background="#696969">
        <TextView
            android:textColor="#FFFFFF"
            android:id="@+id/txtActionBarText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="My Action Bar"
            android:layout_gravity="center"
            android:clickable="true"
            android:layout_centerVertical="true"
            android:textSize="22dp"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="60dp"
            android:layout_centerHorizontal="true" />
    </RelativeLayout>
    
    0 讨论(0)
  • 2021-01-23 00:35

    Valus/styles.xml uses colors.xml file. When you press "control" and click @color/colorPrimary it shows you where colorPrimary comes. Which is colors.xml. In your colors.xml file you can edit it.

    When you click the colour on the left it opens color palette. And you can change it easily.

    0 讨论(0)
提交回复
热议问题