android - Toolbar overlaps activity under coordinate layout -


in activity viewpager , 3 fragments, want auto hide toolbar. this, using android.support.design.widget.coordinatorlayout.

but viewpager giving me problem. if in coordinatelayout, toolbar overlaps activity. if outside coordinatorlayout toolbar activity not overlap webview activity. if viewpager outside coordinatorlayout, auto-hide not work.

any appreciated.

activity_main.xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     tools:context=".mainactivity">      <android.support.design.widget.coordinatorlayout         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"         android:id="@+id/coordinatorlayout"         android:layout_height="wrap_content"         android:layout_width="match_parent"         android:fitssystemwindows="true">          <android.support.design.widget.appbarlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:fitssystemwindows="true">              <android.support.v7.widget.toolbar                 android:id="@+id/tool_bar"                 xmlns:android="http://schemas.android.com/apk/res/android"                 android:layout_height="wrap_content"                 android:layout_width="match_parent"                 xmlns:app="http://schemas.android.com/apk/res-auto"                 android:background="@color/colorprimary"                 android:elevation="2dp"                 android:theme="@style/base.themeoverlay.appcompat.dark"                 android:popuptheme="@style/themeoverlay.appcompat.light"                 app:layout_scrollflags="scroll|enteralways"                 android:fitssystemwindows="true" />              <com.taadu.slidechat.adaptor.slidingtablayout                 android:id="@+id/tabs"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@color/colorprimary"/>          </android.support.design.widget.appbarlayout>          <android.support.v4.view.viewpager             xmlns:android="http://schemas.android.com/apk/res/android"             android:id="@+id/pager"             android:layout_width="match_parent"             android:layout_height="match_parent">         </android.support.v4.view.viewpager>     </android.support.design.widget.coordinatorlayout>  </linearlayout> 

i have been experimenting linear layout, if viewpager in linearlayout activity not overlap, removes function auto-hide.

i have added android.support.v4.widget.nestedscrollview in 1 fragment test auto-hide. please have look.

<android.support.v4.widget.nestedscrollview     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:isscrollcontainer="false"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_gravity="fill_vertical"     android:cliptopadding="false"     app:layout_behavior="@string/appbar_scrolling_view_behavior">       <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:ads="http://schemas.android.com/apk/res-auto"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:orientation="vertical"         app:layout_behavior="@string/appbar_scrolling_view_behavior">          <progressbar             android:id="@+id/progressbar3"             style="?android:attr/progressbarstylehorizontal"             android:layout_width="fill_parent"             android:layout_height="3dip"             android:max="100"             android:progressdrawable="@drawable/greenprogress" />          <webview  xmlns:android="http://schemas.android.com/apk/res/android"             android:id="@+id/webviewtop"             android:layout_width="fill_parent"             android:layout_height="fill_parent"             android:layout_below="@id/progressbar3"/>     </relativelayout>  </android.support.v4.widget.nestedscrollview> 

this because giving layout_behavior nestedscrollview not viewpager

add app:layout_behavior="@string/appbar_scrolling_view_behavior" viewpage

i.e viewpager should like

<android.support.v4.view.viewpager     xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/pager"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:layout_behavior="@string/appbar_scrolling_view_behavior> </android.support.v4.view.viewpager> 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -