bug描述:
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f03018e a=7}
原因:
构造布局填充器对象LayoutInflater.from(context.getApplicationContext())时,传入的上下文对象是全局的,
而布局中使用了新属性(类似selectableItemBackground),全局的上下文就会不支持,程序就会奔溃
-----------------------------------------------------------------------------------------------------------------------------
布局中使用了android:background="?attr/selectableItemBackground"
<TextView
android:background="?attr/selectableItemBackground"
android:id="@+id/tv_city"
android:layout_width="match_parent"
android:layout_height="44dp"
android:gravity="center_vertical"
android:paddingLeft="18dp"
android:text="深圳"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />