XML : Height of a child view is exceeding height of CoordinatorLayout

Below are the xml code of my MainActivity, I think it's pretty standard:

  <?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:layout_width="match_parent"      android:layout_height="match_parent">        <android.support.design.widget.AppBarLayout          android:layout_width="match_parent"          android:layout_height="wrap_content">            <android.support.v7.widget.Toolbar              android:id="@+id/toolbar"              android:layout_width="match_parent"              android:layout_height="?attr/actionBarSize"              app:layout_scrollFlags="scroll|enterAlways"              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"              app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>            <android.support.design.widget.TabLayout              android:id="@+id/tabLayout"              android:layout_width="match_parent"              android:layout_height="wrap_content"              app:popupTheme="@style/ThemeOverlay.AppCompat.Light"              app:tabIndicatorColor="@android:color/white"              app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>        </android.support.design.widget.AppBarLayout>        <android.support.v4.view.ViewPager      android:id="@+id/viewPager"      android:layout_width="match_parent"      android:layout_height="match_parent"      app:layout_behavior="@string/appbar_scrolling_view_behavior"/>    </android.support.design.widget.CoordinatorLayout>    

However, I got this result in preview:

enter image description here

As you can see, the height of ViewPager is exceeding its parent layout and I wonder why? I'm using API level 23, it might be the root cause but I can't lower it down because I'm using a library that highly depends on API 23.

Can someone clarify is this a bug? I can use paddingBottom or layout_MarginBottom as a quick solution but I don't think it's elegant.

No comments:

Post a Comment