Android 3.0 ActionBar,改变颜色
如何更改选项卡下方下划线的颜色?目前它是浅蓝色的,我找不到任何关于如何针对 Android 3.0 更改此设置的资源。
此外,我想更改 ActionBar 右侧显示的菜单项的文本颜色,因为: android:showAsAction="ifRoom|withText"
任何人都知道如何更改这些?
How can I change the color of the underline beneath the tabs? It's currently the light blue, and I can't find any resources on how to change this for Android 3.0.
Additionally, I'd like to change the text color for the menu items that show up on the right of the ActionBar as a result of: android:showAsAction="ifRoom|withText"
Anyone know how to change these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用属性
android:actionBarTabStyle
、android:actionBarTabBarStyle
和android:actionBarTabTextStyle
控制选项卡的外观。官方开发人员指南中的本节显示了用于自定义操作栏样式的示例 xml。
关于菜单选项的文本,请检查属性
actionMenuTextAppearance
和actionMenuTextColor
。You can control the appearance of the tabs by using the properties
android:actionBarTabStyle
,android:actionBarTabBarStyle
, andandroid:actionBarTabTextStyle
.This section in the official developer guide shows a sample xml to customize the action bar's style.
Regarding the text of the menu options check the properties
actionMenuTextAppearance
andactionMenuTextColor
.作为附加信息,以下是我如何找到如何更改每个选项卡下方的蓝色条的方法(上面的答案非常好,但我缺少放在这里的信息,这可能对某人有用)。
您只需将背景更改为 9 块可绘制的背景即可。
它是这样的:
http://android-developers.blogspot.com/2011/04 /customizing-action-bar.html
来源可在此处获取:
http://code.google .com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
此处提供 9 个补丁:
http://code.google.com /p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
我知道这真的很容易,但同样,它可能很有用,所以我只是在这里删除链接。
As additional info, here's how I found out how to change the blue bar below each tab (the answer above is perfectly good, but I lacked little information that I put here, which might be useful to somebody).
You just need to change the background to a 9 patch drawable.
Here's how it looks like:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Source available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable/actionbar_tab_bg.xml
9 patches available here:
http://code.google.com/p/styled-action-bar/source/browse/trunk/res/drawable-mdpi
I know this was really easy, but again, it might be useful so I'm just dropping the links here.
这些解决方案都不适合我。我更改了选项卡的颜色,如下所示:
这是在 theme.xml 中
这是在 styles.xml
这应该使您的选项卡呈绿色。
None of these solutions worked for me. I changed the colors of my tabs as follows:
This is in the themes.xml
This is in styles.xml
This should make your tabs green.
我认为你可以使用:
问候
I think that you can use:
Regards