ActionBar/Tabs 中的 Android 自定义主题

标签 android styles android-actionbar theming

我有主题 Holo.Light.DarkActionBar

选项卡现在设置为白色背景、浅灰色文本——非常难读。我只是想将文本更改为更暗的内容。

我已经搜索了样式以查看是否可以覆盖,但我所能做的就是更改背景,而不是文本。

我可以在 styles.xml 中执行此操作还是必须以编程方式执行此操作?

最佳答案

如果您指的是 ActionBar 的选项卡,请查看这是否改变了颜色:

<!-- The theme for the activity -->
<style name="TabSpecialTheme" parent="android:Theme.Holo.Light.DarkActionBar">
      <item name="@android:attr/actionBarTabTextStyle">@style/TabStyle</item>
</style>

<!-- Modify the text color -->
<style name="TabStyle" parent="android:Widget.Holo.Light.ActionBar.TabText.Inverse">
      <item name="android:textColor">#F70000</item>
</style>

当然不要忘记在 list 中将 Activity 的主题设置为 @style/TabSpecialTheme

关于ActionBar/Tabs 中的 Android 自定义主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11564378/

相关文章:

android - ORMlite Android 外键支持

java - com.edmodo.rangebar.RangeBar 与 viewpager

c++ - ListView 控件忽略扩展样式

android - 如何编写在 android 的操作栏中打开搜索时出现的后退箭头的功能?

android - 使用自定义 View 作为操作栏图标

Android View 动画在屏幕外 View 时停止

android - 2021 年我应该如何为 Android 编译 Rust?

即使在文档末尾调用函数,Javascript getElementById 也找不到 div

html - CSS <div> 样式比子元素短

java - Android - 单击 ActionBar 按钮时创建 PopupMenu