android - Collapsing Toolbar. How to adapt custom Layout instead of default ImageView -
i want make collasping toolbar, in custom layout . on image below presented use of new released design.support lib. on img.1, element (imageview) disappearing. in project want disappear layout. because inside layout viewpager can not resized image, should dissolve in toolbar background - should become transparent.
additionaly want open/hide toolbarlayout moving toolbarfooter - belt move - bright blue layout. expand/collapse not in img.1 instead should works status bar shifts , down blick on toolbarfooter.
the think read lot (collapsing button , layout inside) of i've found clue or implementation. don't know how approach topic. suppose viewpager , relativelayout(or whatever) should outside of toolbar. , should take place of toolbar view this:
<android.support.v4.widget.drawerlayout 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"> <relativelayout 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:layout_width="match_parent" android:layout_height="match_parent" android:clipchildren="false"> <android.support.v7.widget.toolbar android:id="@+id/app_bar" android:layout_width="match_parent" android:layout_height="@dimen/app_bar_max_height" android:minheight="?attr/actionbarsize" app:popuptheme="@style/themeoverlay.appcompat.light" app:theme="@style/appbartheme"> <button android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:layout_alignparenttop="true" android:layout_gravity="left|top" android:gravity="center_vertical|left" android:text="toolbartitle" android:background="?android:attr/selectableitembackground" android:textallcaps="false"/> </android.support.v7.widget.toolbar> <net.android.app.views.viewpagertoolbar android:id="@+id/calendar_viewpager" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_margintop="?attr/actionbarsize"/> <relativelayout android:id="@+id/toolbar_footer" android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" android:layout_alignparenttop="false" android:layout_alignbottom="@+id/app_bar"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_marginbottom="8dp" android:text="@string/belt_to_move"/> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:text="@string/belt_to_move"/> </relativelayout> <android.support.v4.widget.drawerlayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/app_bar"> <android.support.v4.view.viewpager android:id="@+id/vp_container" android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.v4.widget.drawerlayout> </relativelayout> <android.support.design.widget.navigationview android:id="@+id/navview" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start"/>
now can tell me component should use? support library offers coordinatelayout, collapsedtoolbar, appbar. standard approach can use relativelayout or framelayout overlap view. guys recommend me, how side should eat cake?
updated:
finally i've found solution. isn't collapsingtoolbar viewdraghelper. solution followed: blog, github project, youtube explanation,
you need attach viewpager above toolbar. example imageview :
<android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="240dp" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:elevation="2dp"> <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:elevation="2dp" app:collapsedtitletextappearance="?attr/autocompletetextviewstyle" app:layout_scrollflags="scroll|exituntilcollapsed"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" > // put here content <android.support.v7.widget.toolbar android:id="@+id/anim_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:elevation="2dp" app:popuptheme="@style/themeoverlay.appcompat.light"/> </relativelayout> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout>
Comments
Post a Comment