Change action bar text color

Asked 1 years ago, Updated 1 years ago, 123 views

How do I change the color of the letter in the action bar? I inherited the HoloLight Theme, but I can change the background color of the action bar, but I can't find the text color attribute.

Android:textColorPrimary, I'm going to change the text color, but when I click the action bar button, the text in the drop-down menu changes. How do I change the color of the drop-down menu or list?

android android-actionbar android-3.0-honeycomb android-text-color

2022-09-22 21:31

1 Answers

There is a good way to change the color of the action bar title only. If you do this, you can change the color of the subject.

Add it to styles.xml like 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>


2022-09-22 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.