简体   繁体   English

造型ActionBar

[英]Styling the ActionBar

Re this example from the Android developer blog http://android-developers.blogspot.com/2011/04/customizing-action-bar.html It says that to style the tabs on the action bar, to use a style like this: 从Android开发人员博客http://android-developers.blogspot.com/2011/04/customizing-action-bar.html重新查看该示例。它说,要对操作栏上的标签设置样式,请使用如下样式:

<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBarView_TabView">
<item name="android:background">@drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>

It references a parent style of "android:style/Widget.Holo.Light.ActionBarView_TabView" - which my project is unable to locate. 它引用了“ android:style / Widget.Holo.Light.ActionBarView_TabView”的父样式-我的项目无法找到该样式。 I'm building against v3.2, with a min sdk of platform 8 (v2.2). 我正在针对v3.2进行构建,并使用最小SDK平台8(v2.2)。 I'm using ActionBarSherlock. 我正在使用ActionBarSherlock。

Am I doing something wrong, or is the sample code incorrect? 我做错了什么,还是示例代码不正确? What style can I inherit from? 我可以继承什么风格?

Am I doing something wrong, or is the sample code incorrect? 我做错了什么,还是示例代码不正确?

The sample code was correct at the time and no longer is correct. 该示例代码当时是正确的,不再正确。

@Macarse has a blog post with the fix. @Macarse 的博客文章中包含此修复程序。 Quoting Xav's comment on the related issue : 引用Xav对相关问题的评论:

What is happening is that some styles, like WindowTitle are not public (you won't find them in android.R.style). 发生的事情是某些样式(例如WindowTitle)不是公开的(您不会在android.R.style中找到它们)。 You should not be extending non public resources. 您不应该扩展非公共资源。 aapt used to let you do that but it was a bug which was fixed in platform-tools r6. aapt曾经让您做到这一点,但这是一个错误,已在平台工具r6中修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM