Reputation: 5764
I'm using the CoordinatorLayout and a ViewPager inside. The problem is, that the first entries of the List (in first page of the ViewPager) are hidden by the Tabs. When I use LinearLayout instead of the CoordinatorLayout, everything works fine.
Here's the XML:
<?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:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager_list_views"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@android:drawable/ic_menu_add"
app:layout_anchor="@id/pager_list_views"
app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
Upvotes: 1
Views: 721
Reputation: 4410
add this to ViewPager
app:layout_behavior="@string/appbar_scrolling_view_behavior"
if you use CoordinatorLayout
you'll have to specifify a behaviour, it's safer if you control these aspects of your design.
Upvotes: 2