I'have got an InflateException while trying to inflate layout in my pager adapter. Same item works great with recycler view, but crashs when calling inflate method.
Does any one have an answer ?
Here is my code XML R.layout.item_winner
:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_winner_cell"
android:layout_marginStart="@dimen/dimen_10dp"
android:paddingStart="@dimen/dimen_14dp"
android:paddingTop="@dimen/dimen_12dp"
android:paddingBottom="@dimen/dimen_12dp"
android:paddingEnd="@dimen/dimen_10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/winner_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_winner"
android:src="@drawable/ic_user_placeholder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:src="@drawable/ic_coordinated_star"
app:layout_anchor="@id/iv_winner"
app:layout_anchorGravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
and here is the inflate :
View view = LayoutInflater.from(mContext).inflate(R.layout.item_winner, container, false);
Ps : design library is included :
implementation 'com.android.support:design:26.1.0'
The log :
android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.support.design.widget.CoordinatorLayout
Caused by: java.lang.reflect.InvocationTargetException