Reputation: 31
Here is my activity in which I have used coordinate layout and view pager.
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include layout="@layout/venue_app_bar_content" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:tabIndicatorColor="@android:color/white"
app:tabMode="scrollable"
app:tabSelectedTextColor="@color/white"
app:tabTextColor="@color/white50" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
When run app, it get crashed with message : Caused by: java.lang.RuntimeException: Could not inflate Behavior subclass android.support.design.widget.scroll_behavior
Upvotes: 3
Views: 12624
Reputation: 746
The layout_behavior line must be replace with this:
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
make sure this dependency exists in build.gradle:
implementation 'com.google.android.material:material:1.0.0'
Upvotes: 17
Reputation: 19273
If you have androidx then you should manually do the mapping of classes used in XML to the new ones:
https://developer.android.com/jetpack/androidx/migrate
Upvotes: 0
Reputation:
What you should try is to delete the string resource in strings.xml file.Thats what solved the problem for me.
Upvotes: 0