簡體   English   中英

我們如何更改android中customactionbar的標題文本顏色?

[英]how can we change the title text color of customactionbar in android?

這是我的styles.xml 文件。 你能告訴我如何更改操作欄的標題文本顏色。 默認情況下,文本顯示為黑色。

樣式文件

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.

-->
<style name="AppBaseTheme" parent="android:Theme.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:background" >@color/MyColor</item>
    <item name="background">@color/MyColor</item>
</style>

<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light">
    <item name="android:actionBarStyle" >@style/MyActionBar</item>
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

好的,我找到了更好的方法。 我現在只能更改標題的顏色,您還可以調整副標題。

這是我的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 name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/red</item>

</resources>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM