android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
出現這種錯誤有可能是,你的布局當中某個wedget的屬性出錯,比如引用了?attr/xxxx,但是你的主題里面卻沒有給這個attr賦值。
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/llPlaceHolderLoading" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:background="?attr/primary_page_background" android:gravity="center" android:orientation="vertical" android:visibility="visible" > <ProgressBar style="@style/AppTheme.Widget.Progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" /> <TextView android:id="@+id/tvLoadTip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="?attr/loading_tip" android:textColor="@color/progress_tips_text_color" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout>
像這樣的在style里面沒有把attr賦值,這個界面是加載不錯來,並且報錯
02-03 17:24:50.746: E/AndroidRuntime(10702): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.realtor.app.extranet.cmls/net.realtor.app.extranet.cmls.ui.activity.TestActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class android.widget.ProgressBar