Honeycomb 的 Android ActionBar 选项卡样式
我正在 SDK 中使用 HoneycombGallery 示例应用程序,并尝试更改 ActionBar 选项卡的样式(即“气球”、“自行车”、“Android”、“糕点”)。使用“浅色”主题,选项卡具有蓝色下划线。我只是想将其设为红色以匹配我正在开发的应用程序的风格。
我尝试过研究 SDK 文档中的样式 (http://developer.android.com/guide/topics/ui/actionbar.html )和网络上的其他来源,但我不太确定我理解什么属性/属性控制选项卡的这种特定样式。
如果有人有可以演示 ActionBar 的完整自定义样式的资源或代码示例,我将不胜感激。
I am using the HoneycombGallery sample app in the SDK and attempting to change the style of the ActionBar tabs (i.e., "Balloons", "Bikes", "Androids", "Pastries"). Using the "light" theme, the tabs have a blue underline. I simply want to make this red to match the style of an application I'm working on.
I've tried researching styles in the SDK documentation (http://developer.android.com/guide/topics/ui/actionbar.html) and other sources on the web, but I'm not quite certain that I understand what property/attribute controls this particular style of the tabs.
If anyone has a resource or code example that might demonstrate a complete custom styling of the ActionBar, I would appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要熟悉如何将自定义主题应用于活动。 http://developer.android.com/guide/topics/ui/themes.html
主题属性
android:actionBarTabStyle
、android:actionBarTabBarStyle
和android:actionBarTabTextStyle
控制操作栏选项卡的外观。默认样式在选项卡栏样式中使用android:background
作为未选定项目下的细线,并使用可绘制的状态列表作为android:background
供选项卡本身处理聚焦/选择/按下状态。背景资源本身是 9 个补丁,在大多数情况下提供下划线,但为按下/聚焦状态提供更全面的突出显示。You'll want to be familiar with applying a custom theme to an activity. http://developer.android.com/guide/topics/ui/themes.html
The theme attributes
android:actionBarTabStyle
,android:actionBarTabBarStyle
, andandroid:actionBarTabTextStyle
control the appearance of action bar tabs. The default styling usesandroid:background
within the tab bar style for the thin line under unselected items, and a state list drawable as theandroid:background
for the tabs themselves to handle focused/selected/pressed states. The background assets themselves are 9-patches that provide the underline in most cases but a more comprehensive highlight for pressed/focused states.