Why does my ViewPager fail inside the Layout coordinator?

For some reason I can’t understand the Viewpager in the image below is overflowing with the size of the menu. I probably can’t imagine something, but I don’t see that.

As you can see, the selected ViewPager goes beyond

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="160dp"
    android:paddingTop="@dimen/appbar_padding_top"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="wrap_content"
        android:layout_height="160dp"
        >
    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/container"
    android:layout_width="match_parent"

    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    />

+4
source share
1 answer

Your ViewPagercrashes because of the flag

app:layout_behavior="@string/appbar_scrolling_view_behavior"

which you installed in your XML format . We mainly used this when you want to use the scroll effects of Google Material Design. If you are not interested in handling scrolls with CoordinatorLayout, you can simply delete this line.

+2
source

Source: https://habr.com/ru/post/1617837/


All Articles