gpt4 book ai didi

Android Actionbar 导航微调器文本颜色

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:33:18 26 4
gpt4 key购买 nike

我可以更改导航微调器的背景:

  <style name="MyTheme" parent="android:style/Theme.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
</style>

<style name="MyDropDownNav" parent="android:style/Widget.Spinner">
<item name="android:background">@drawable/spinner_white</item>
<item name="android:textColor">@color/red</item>
</style>

然而,textColor 没有改变。我还尝试了其他方法来更改 textColor:

 <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">?color_actionbar</item>
<item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
</style>

<style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
<item name="android:textColor">@color/violet</item>
</style>

还有其他想法吗?

最佳答案

我一直在寻找相同的答案,但没有找到任何答案,所以我尝试了这个解决方案。至少我为我工作。

在主题文件中,您可以为 spinnerDropdownItemStyle 设置样式:

<style name="YourTheme" parent="YourParentTheme">
<item name="android:spinnerDropDownItemStyle">@style/YourCustomDropDownItemStyle</item>
</style>

现在,为您的样式设置文本外观:

<style name="YourCustomDropDownItemStyle" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:textAppearance">@style/YourCustomDropDownItemTextStyle</item>
</style>

在您的自定义文本外观中,您可以设置文本详细信息:

<style name="YourCustomDropDownItemTextStyle" parent="@android:style/Widget">
<item name="android:textColor">@color/white</item>
<!-- Here you can set the color and other text attributes -->
</style>

希望这对您有所帮助!

关于Android Actionbar 导航微调器文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12395381/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com