android - Collapsible layout below Toolbar -
i have viewpager based ui tabs , 1 fragment load have coordinatorlayout appbarlayout , toolbar. have animations when scrolling content , keep layout fixed @ top. seems when coordinator collapsed:
the problem when layout collapsed can't continue scroll content. trying fix week , don't know if it's possible fix or should leave idea , different. right behavior should keep header (weather icon, temperature, content inside coordinatorlayout) fixed once collapsed , scroll content below layout.
i post here activity layout , basic structure of fragment layout.
main activity layout
<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:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.mlkapps.meteo.mainactivity"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/apptheme.popupoverlay"> </android.support.v7.widget.toolbar> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" />
fragment layout
<android.support.design.widget.coordinatorlayout android:id="@+id/coordinator" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="220dp" android:fitssystemwindows="true"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed" android:fitssystemwindows="true"> <android.support.constraint.constraintlayout android:layout_width="match_parent" android:layout_height="match_parent"> <!--toolbar content: temperature, weather icon...--> </android.support.constraint.constraintlayout> <android.support.v7.widget.toolbar android:id="@+id/main.toolbar" android:layout_width="match_parent" android:layout_height="90dp" app:popuptheme="@style/themeoverlay.appcompat.light" app:layout_collapsemode="pin" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.nestedscrollview android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <linearlayout android:id="@+id/recycler" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingtop="@dimen/nav_header_height"> <android.support.v7.widget.recyclerview android:id="@+id/hourlyrecyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="@dimen/activity_vertical_margin" android:paddingbottom="42dp"/> </linearlayout> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.constraint.constraintlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <!--some textview here--> </android.support.constraint.constraintlayout> </android.support.v7.widget.cardview> </linearlayout> </android.support.v4.widget.nestedscrollview> </android.support.design.widget.coordinatorlayout>
Comments
Post a Comment