android - ways to add 18dpx18dp size image right of title in collapsing toolbar layout? but not in toolbar -
- i want put icon right title in collapsing tool bar, shown below
- but after collapsing don't want show in tool bar.
i want hide after collapsing.
i have done thing. using
collapsingtoolbarlayout.settitle(item.getname()); collapsingtoolbarlayout.setforeground(getresources().getdrawable(r.drawable.ic_photo_library_white_24dp));
which this.
i still trying adjust image.
but want hide image after collapsing. bez looks this.
here java code.
private void settoolbar(product item) { ((appcompatactivity) getactivity()).setsupportactionbar((producttoolbar)); actionbar actionbar = ((appcompatactivity) getactivity()).getsupportactionbar(); actionbar.settitle(""); producttoolbar.setnavigationonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { getactivity().onbackpressed(); } }); collapsingtoolbarlayout.settitle(item.getname()); collapsingtoolbarlayout.setforeground(getresources().getdrawable(r.drawable.ic_photo_library_white_24dp)); collapsingtoolbarlayout.set }
and xml file.
<android.support.design.widget.coordinatorlayout android:id="@+id/product_detail_main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:apptools="http://schemas.android.com/tools" 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="@dimen/product_detail_appbar_height" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/detail_product_collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" android:foregroundgravity="bottom|right" android:foregroundtintmode="add" android:cliptopadding="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginstart="@dimen/space_xxlarge" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:id="@+id/header" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/image" android:fitssystemwindows="true" android:scaletype="centercrop" app:layout_collapsemode="parallax" app:layout_collapseparallaxmultiplier="0.7"/> <android.support.v7.widget.toolbar android:id="@+id/product_toolbar_title" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:fitssystemwindows="true" app:layout_collapsemode="pin" app:navigationicon="@drawable/ic_arrow_back_white_24dp" app:popuptheme="@style/themeoverlay.appcompat.light" app:theme="@style/themeoverlay.appcompat.dark.actionbar"/> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v4.widget.nestedscrollview ........ <android.support.design.widget.coordinatorlayout
- thanks in advance. ^_^
i got solution issue.
- collapsingtoolbarlayout child views not shown in devices< android l 5.1 including 5.0
here link
Comments
Post a Comment