アクションバーのテキストの色 質問する

アクションバーのテキストの色 質問する

ActionBar のテキストの色を変更するにはどうすればよいですか? Holo Light テーマを継承しており、ActionBar の背景を変更することはできますが、テキストの色を変更するために調整する属性が何であるかがわかりません。


わかりました。android:textColorPrimary 属性を使用してテキストの色を変更することはできますが、ActionBar ボタンでオーバーフローが発生したときに表示されるドロップダウン メニューのテキストの色も変更されます。これらのドロップダウン メニュー/リストの色を変更する方法はありますか?

ベストアンサー1

わかりました。もっと良い方法を見つけました。タイトルの色だけを変更できるようになりました。サブタイトルも微調整できます。

私のstyles.xmlは次のとおりです:

<?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>

おすすめ記事