我的应用在带有InflateException
的Android 6.0(仿真器或真正的Samsung S5)上崩溃。但是,它可以在装有Android 7.0到9.0的任何其他设备上正常工作
Stacktrace:
02-19 08:58:28.458 4408-4408/com.audiodesignguide.www.hqp6 W/ResourceType: Failure getting entry for 0x7f08008c (t=7 e=140) (error -75)
02-19 08:58:28.459 4408-4408/com.audiodesignguide.www.hqp6 D/AndroidRuntime: Shutting down VM
02-19 08:58:28.483 4408-4408/com.audiodesignguide.www.hqp6 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.audiodesignguide.www.hqp6, PID: 4408
android.view.InflateException: Binary XML file line #31: Binary XML file line #31: Error inflating class android.widget.ImageButton
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.audiodesignguide.www.hqp6.HomeFragment.onCreateView(HomeFragment.java:114)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
我的onCreateView()
代码:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.i(TAG, "HomeFragment - onCreateView() - start");
View rootView = inflater.inflate(R.layout.fragment_home, container, false);
Log.i(TAG, "-0-");
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:theme="@style/Spinner"
android:textSize="15dp"
android:background="@color/colorBackgroundBody" >
<TextView
android:id="@+id/version"
android:layout_width="800px"
android:layout_height="20dp"
android:layout_marginStart="5dp"
android:layout_marginTop="8dp"
android:text="System configuration"
android:textColor="@color/colorTextBody"
android:textSize="15dp" />
<ImageButton
android:id="@+id/reload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_alignParentBottom="true"
android:layout_marginStart="210dp"
android:layout_marginTop="30dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/reload" />