簡體   English   中英

如何在Android 5.0 Lollipop中更改ActionBar文本顏色?

[英]How to change the ActionBar text color in Android 5.0 Lollipop?

如何將Android Lollipop中的ActionBar中的文本顏色更改為黑色中的白色?

這是我目前的造型。

<style name="AppCustomTheme" parent="@style/Theme.AppCompat.Light">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/orange_bar</item>
</style>

使用@style/Theme.AppCompat.Light.DarkActionBar來交換文本和許多其他屬性的顏色,以更好地適應深色操作欄。

我已經閱讀了更多內容並設法發現您需要添加此標記才能更改Android Lollipop中的ActionBar默認顏色。

    <!--textColorPrimary is used to change the text color of the default action bar-->
    <item name="android:textColorPrimary">#FFFFFF</item>

5.0 Lollipop4.4 KitKat上測試它

<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <!-- To change action bar text color -->
    <item name="android:textColorPrimary">#123</item>

    <!-- This has to be here to make it work; let me know if you know why -->
    <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item>        

</style>

暫無
暫無

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

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