我从crashlytics获得下一个错误:android.view.InflateException:二进制XML文件行#14:二进制XML文件行#14:错误导致类TextView
问题是我无法重现此问题,我只能猜到为什么app在尝试给TextView充气时崩溃了。 此TextView位于drawer_item_1.xml文件中,该文件是应用程序抽屉的菜单项。
仅在运行Android 7.1.1和7.1.2(Nexus 6P,Nexus 5x,Pixel XL和Sony Xperia X)的设备上报告此问题
正如我所看到的,这里没有什么可疑的,它是简单的TextView,其中一些白色文本设置为粗体,除了layout_width设置为wrap_content,因为set layout_weight应该是0dp。是否有可能造成这种崩溃?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:src="@drawable/ic_add"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="My String"
android:textColor="@color/white"
android:textStyle="bold"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rbn_menu_arrow"
/>