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" />