Android - Scroll of the content to top of the screen -


i have app structure of image below (1) in xml. need scroll, app remains in image (2). not know how works nicely coordinatorlayout, nestedscrollview...

what changes need in xml it? thank you

enter image description here

xml

<linearlayout     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:orientation="vertical"     android:background="@color/color_primary_dark">      <include         android:id="@+id/fondo_toolbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         layout="@layout/toolbar" />      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical">          <relativelayout             android:layout_width="match_parent"             android:layout_height="200dp"             android:background="@color/black">              <com.example.hackyviewpager                 android:id="@+id/home_pager"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 android:background="@color/grey_dark"/>              <com.viewpagerindicator.circlepageindicator                 android:id="@+id/home_indicator"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@android:color/transparent"                 android:padding="15dp"/>          </relativelayout>          <include             android:id="@+id/home_footer"             layout="@layout/home_footer"             android:layout_width="match_parent"             android:layout_height="wrap_content"/>          <android.support.design.widget.tablayout             android:id="@+id/sliding_tabs"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:background="@color/color_primary_dark"             android:elevation="0dp"             app:tabmode="scrollable"             app:tabgravity="center"/>          <android.support.v4.view.viewpager             android:id="@+id/tabpager"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:background="@color/grey_dark" />      </linearlayout>  </linearlayout> 

do below rough idea:-

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools" >   <android.support.design.widget.appbarlayout         android:id="@+id/appbarlayout"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:fitssystemwindows="true"         android:theme="@style/themeoverlay.appcompat.dark.actionbar">          <android.support.design.widget.collapsingtoolbarlayout             android:id="@+id/collapsing_toolbar"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:fitssystemwindows="true"             app:contentscrim="?attr/colorprimary"             app:expandedtitlemarginend="64dp"             app:expandedtitlemarginstart="48dp"             app:layout_scrollflags="scroll|exituntilcollapsed">             <com.example.hackyviewpager             android:id="@+id/home_pager"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:background="@color/grey_dark"/>               <android.support.v7.widget.toolbar                 android:id="@+id/toolbar"                 android:layout_width="match_parent"                 android:layout_height="?attr/actionbarsize"                 app:layout_collapsemode="pin"                 app:popuptheme="@style/themeoverlay.appcompat.light" />          </android.support.design.widget.collapsingtoolbarlayout>     </android.support.design.widget.appbarlayout>  <android.support.v4.widget.nestedscrollview         android:id="@+id/scroll"> <!-- put own design relative layout viewpager etc -->  </android.support.v4.widget.nestedscrollview> </android.support.design.widget.coordinatorlayout> 

this rough idea, can adjust according design don't copy paste code won't work. have given code give brief idea how use nestedscrollview , coordinatorlayout. more understanding can check material design tutorials


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -