Android CoordinatorLayout + AppbarLayout + Viewpager布局超过屏幕高度
问题描述:
当我把Viewpager与CoordinatorLayout + AppbarLayout + Viewpager一起使用时,viewpager超出屏幕大小,请帮我解决。Android CoordinatorLayout + AppbarLayout + Viewpager布局超过屏幕高度
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways|snap" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</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" />
</android.support.design.widget.CoordinatorLayout>
正如你所看到的,ViewPager的高度超过其引起下面一些裁剪元素的父布局,我不知道为什么?
答
请删除 “程序:layout_behavior”,检查
应用:layout_behavior = “@字符串/ appbar_scrolling_view_behavior”
u能PLZ在设备上运行,并再次 –
CHK给它的屏幕截图@vishal patel bro –