android - Fixed TabLayout and Content overlap AppBar -


tablayout scroll

with new android support design library, there has come cool features regards appbar.

i'm looking @ implementing same scroll effect shown in gif above. (taken google play games -> games)

i've had @ adding following attribute nestedscrollview, placing content above appbar.

app:behavior_overlaptop 

it works expected when components inside appbar set scroll.

app:layout_scrollflags="scroll" 

if want tablayout pinned @ top, space below pinned. looks weird:

my implementation

in short, there way create above using new design library, or have make other way?

requested xml:

<android.support.design.widget.coordinatorlayout     android:id="@+id/content"     android:layout_height="match_parent"     android:layout_width="match_parent">      <android.support.design.widget.appbar         android:id="@+id/appbar"         android:layout_width="match_parent"         android:layout_height="164dp"         android:background="?attr/colorprimary">          <android.support.v7.widget.toolbar             android:id="@+id/toolbar"             android:layout_width="match_parent"             android:layout_height="?attr/actionbarsize"             app:layout_scrollflags="scroll"/>          <android.support.design.widget.tablayout             android:id="@+id/tablayout"             android:layout_width="match_parent"             android:layout_height="wrap_content"             app:layout_scrollflags="scroll|enteralways"/>      </android.support.design.widget.appbar>      <android.support.v4.view.viewpager         android:id="@+id/viewpager"         android:layout_height="match_parent"         android:layout_width="match_parent"         android:cliptopadding="false"         app:layout_behavior="@string/appbar_scrolling_view_behavior"         app:behavior_overlaptop="32dp"/>  </android.support.design.widget.coordinatorlayout> 

try this, hope work

set app:layout_scrollflags="scroll|enteralways" in toolbar , android:scrollbars="horizontal" in tablayout

as per suggestion, should remove line app:layout_scrollflags="scroll|enteralways" in tablayout

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app1="http://schemas.android.com/apk/res/com.samsung.ssc" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" tools:context="com.samsung.ssc.lms.lmslistactivity">  <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/toolbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/colorprimary"         android:elevation="4dp"         android:minheight="?attr/actionbarsize"         app:layout_scrollflags="scroll|enteralways">       </android.support.v7.widget.toolbar>      <android.support.design.widget.tablayout         android:id="@+id/tablayoutlmslist"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:background="?attr/colorprimary"         android:scrollbars="horizontal">       </android.support.design.widget.tablayout> </android.support.design.widget.appbarlayout>  <android.support.v4.view.viewpager     android:id="@+id/viewpagerlmslist"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     app:layout_behavior="@string/appbar_scrolling_view_behavior" />   <android.support.design.widget.floatingactionbutton     android:id="@+id/fabcreatenewlms"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_alignparentend="true"     android:layout_alignparentright="true"     android:layout_gravity="right|bottom"     android:layout_margin="@dimen/margin_15"     android:onclick="onnewleavecreateclick"     android:src="@drawable/ems_pencil"     app1:ripplecolor="@color/ems_status_sky_blue_color"     app:backgroundtint="@color/ems_status_yellow_color"     app:borderwidth="@dimen/margin_0"     app:elevation="@dimen/margin_5" /> 


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -