0

I observed that adding appbar_scrolling_view_behavior to a ViewPager and that viewPager is not fullScreen (in my case contains some bottom buttons/tabs), then the viewPager has a bigger height (with the height of the toolbar I guess) and overlaps with the other layout(in my case those tabs)

See the images below (one is with the toolbar scrolled up) See how the recyclerView from the viewPager is BELOW the tabs

Now the toolbar is scrolled up and the viewPager is OK now

This is the xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".AudioRecActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottomLayout">

    <android.support.design.widget.AppBarLayout android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:elevation="0dp">

        <android.support.v7.widget.Toolbar android:id="@+id/acb_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:theme="@style/AppTheme.AppBarOverlay"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:layout_scrollFlags="scroll|enterAlways">

        </android.support.v7.widget.Toolbar>
    </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>

<LinearLayout
    android:id="@+id/bottomLayout"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    <audiorec.com.gui.views.SlidingTabLayout
        android:id="@+id/sliding_tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@color/secondary" >
    </audiorec.com.gui.views.SlidingTabLayout>

    <FrameLayout
        android:id="@+id/adsContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/secondary" >

        <TextView
            android:id="@+id/loading_ad_tv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/advertisement_loading"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="#ffffff" />
    </FrameLayout>
</LinearLayout>

How the ViewPager/CoordinatorLayout content can be under that Linearlayout if I specified not to be?

Alexandru Circus
  • 5,478
  • 7
  • 52
  • 89

1 Answers1

0

I found an answer here:link and works for me as well

It appears it is a "problem" from android team....see here: issue on android

Community
  • 1
  • 1
Alexandru Circus
  • 5,478
  • 7
  • 52
  • 89