Android Toolbar collapseMode issue -
i have issue making " toolbar title text " not collapse while scrolling upwards in collapsingtoolbarlayout.
i have tried few tweaks, using app:layout_collapsemode="none" attribute in android.support.v7.widget.toolbar not working. maybe there problem layout.
below trying achieve.
but when scroll top, toolbar collapse, , tabbar scrolls inside, , become non-visible. below have now.
this layout code
<android.support.design.widget.coordinatorlayout 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.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways"> <framelayout android:layout_width="match_parent" android:layout_height="250dp" app:layout_collapsemode="parallax" app:layout_collapseparallaxmultiplier="0.7"> <imageview android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" /> <view android:layout_width="match_parent" android:layout_height="match_parent" android:background="#20000000" /> </framelayout> <android.support.v7.widget.toolbar android:id="@+id/toolbar" app:popuptheme="@style/themeoverlay.appcompat.light" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="none" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="application title" android:textcolor="#fff" android:textsize="18sp" /> </android.support.v7.widget.toolbar> </android.support.design.widget.collapsingtoolbarlayout> <android.support.design.widget.collapsingtoolbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="scroll|enteralways"> <android.support.design.widget.tablayout android:id="@+id/detail_tabs" android:layout_width="match_parent" android:layout_height="60dp" app:layout_collapsemode="pin" android:background="#00000000" app:tabselectedtextcolor="#3498db" app:tabtextcolor="#000" /> /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#333" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.design.widget.coordinatorlayout>
dependencies
dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile "com.android.support:appcompat-v7:22.2.1" compile "com.android.support:support-annotations:22.2.1" compile "com.android.support:design:22.2.1" compile 'com.android.support:recyclerview-v7:22.2.1' compile 'com.android.support:cardview-v7:22.2.1' }
try this...
you have use app:layout_scrollflags="scroll|exituntilcollapsed" instead of app:layout_scrollflags="scroll|enteralways" inside collapsingtoolbarlayout
and use app:layout_collapsemode="pin" inside toolbar
<android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollflags="scroll|exituntilcollapsed" app:contentscrim="?attr/colorprimary" > <framelayout android:layout_width="match_parent" android:layout_height="250dp" app:layout_collapsemode="parallax" app:layout_collapseparallaxmultiplier="0.7" > <imageview android:id="@+id/backdrop" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop" /> <view android:layout_width="match_parent" android:layout_height="match_parent" android:background="#20000000" /> </framelayout> <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" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="application title" android:textcolor="#fff" android:textsize="18sp" /> </android.support.v7.widget.toolbar> </android.support.design.widget.collapsingtoolbarlayout>
Comments
Post a Comment