【发布时间】:2013-06-14 20:39:26
【问题描述】:
我有一个与 ActionBarSherlock 声明相关的问题:
android:background="?activatedBackgroundIndicator"
问题是,如果我在这样的布局中使用这个值:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?activatedBackgroundIndicator">
.....
如果我使用主题,包含此 XML 崩溃的适配器:
<style name="AppTheme" parent="@style/Theme.Sherlock.Light.DarkActionBar">
但如果我将主题更改为:
<style name="AppTheme" parent="@style/Theme.Sherlock.Light">
这是 ActionBarSherlock 的错误吗?或者我做错了什么?重复它崩溃如果我 使用 Light.DarkActionBar 主题,但如果我使用 Light 主题,则可以使用。
我测试改变:
android:background="?activatedBackgroundIndicator"
为此:
android:background="?android:attr/activatedBackgroundIndicator"
这是原始属性并且有效。
这是堆栈跟踪:
FATAL EXCEPTION: main
E/AndroidRuntime( 1574): android.view.InflateException: Binary XML file line #2: Error inflating class...
....
E/AndroidRuntime( 1574): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010047 a=-1}
E/AndroidRuntime( 1574): at android.content.res.Resources.loadDrawable(Resource
提前致谢。
【问题讨论】:
-
您正在尝试设置自定义
activatedBackgroundIndicator?如果是,正确的方法是设置android:background="?android:attr/activatedBackgroundIndicator"。
标签: android android-layout android-listview actionbarsherlock android-actionbar