?attr/actionBar大小膨胀导致崩溃

问题描述:

以下两行似乎都会导致应用程序通货膨胀崩溃。?attr/actionBar大小膨胀导致崩溃

android:layout_height="?attr/actionBarSize" 
    // or 
    android:layout_height="?android:attr/actionBarSize" 

任何想法?我正在尝试创建自己的栏,这是标准操作栏的默认大小。下面

例外:

FATAL EXCEPTION: main 
Process: com...., PID: 30039 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com....../com.....}: 
android.view.InflateException: Binary XML file line #9: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f010071 a=-1} 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2728) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6290) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Caused by: android.view.InflateException: Binary XML file line #9: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f010071 a=-1} 
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f010071 a=-1} 
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:761) 
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:7039) 
at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:7220) 
at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1926) 
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1824) 
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1823) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:860) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
+0

你可以尝试按ctrl +点击'ATTR/actionBarSize'看看它的初始化? R文件 –

+0

把你的XML文件,所以我们可以看到什么是错误 –

+0

''这个工作适合我..你可能采取了错误的布局... –

尝试

@dimen/abc_action_bar_default_height_material 

,而不是

?android:attr/actionBarSize