android - how to hide image view on coordinate layout (like fab hide on scroll)? -
i want hide/disappear image view(like fab) when scroll coordinate layout behavior behave first
and layout xml
<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"> <linearlayout android:id="@+id/lyoutfeedloadmore" android:layout_width="match_parent" android:layout_height="40dp" android:layout_alignparentbottom="true" android:background="#fafafa" android:gravity="center" android:visibility="gone"> <progressbar android:id="@+id/progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </linearlayout> <view android:id="@+id/bottomview" android:layout_width="match_parent" android:layout_height="0.5dp" android:layout_alignparentbottom="true" android:background="@color/white" /> <android.support.design.widget.coordinatorlayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.photex.urdu.textonphotos.activities.scrollingactivity" android:layout_above="@+id/bottomview" android:layout_alignparentleft="true" android:layout_alignparentstart="true"> <android.support.design.widget.appbarlayout android:id="@+id/main.appbarlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:fitssystemwindows="true" android:orientation="vertical" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/main.collapsing" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:layout_scrollflags="scroll|exituntilcollapsed"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <framelayout android:id="@+id/main.framelayout.title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/main.backcover" android:layout_gravity="bottom" android:layout_marginleft="120dp" android:layout_marginstart="120dp" android:background="@color/white" android:orientation="vertical" app:layout_collapsemode="parallax" app:layout_collapseparallaxmultiplier="0.3"> <linearlayout android:id="@+id/pfinfo" android:layout_width="match_parent" android:layout_height="wrap_content" android:baselinealigned="false" android:orientation="horizontal" android:weightsum="3"> <linearlayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginleft="12dp" android:layout_marginstart="12dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <textview android:id="@+id/txtcountpost" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="12dp" android:text="-" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/txtpost" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="8dp" android:text="post" android:textcolor="@android:color/black" /> </linearlayout> <linearlayout android:id="@+id/layout_followers" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <textview android:id="@+id/txtcountfollowers" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="12dp" android:text="-" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/txtfollowers" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="8dp" android:text="followers" android:textcolor="@android:color/black" /> </linearlayout> <linearlayout android:id="@+id/layout_following" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <textview android:id="@+id/txtcountfollowing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="12dp" android:text="-" android:textcolor="@android:color/black" android:textsize="18sp" android:textstyle="bold" /> <textview android:id="@+id/txtfollowing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="8dp" android:text="following" android:textcolor="@android:color/black" /> </linearlayout> </linearlayout> </framelayout> <linearlayout android:id="@+id/main.section" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/main.framelayout.title" android:layout_margin="16dp" android:orientation="vertical"> <textview android:id="@+id/txtname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxlines="1" android:text="nasdnfasdnfasdhfjasdhfahsdfahsdasdfa" android:textcolor="@android:color/black" android:textsize="16sp" android:textstyle="bold" /> <textview android:id="@+id/txtbio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="8dp" android:ellipsize="end" android:maxlines="5" android:text="fgsfgdfgsdfgdfg" android:textcolor="@android:color/black" android:textsize="16sp" android:visibility="visible" /> <textview android:id="@+id/txtfallowedby" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="8dp" android:ellipsize="end" android:maxlines="2" android:text="success diaries" android:textcolor="@android:color/black" android:textsize="16sp" android:visibility="gone" /> </linearlayout> <button android:id="@+id/btnfollowedit" android:layout_width="wrap_content" android:layout_height="35dp" android:layout_below="@+id/main.section" android:layout_centerinparent="true" android:background="@drawable/bg_rectangle_white" android:minwidth="150dp" android:onclick="onclick" android:text="follow" android:textcolor="@android:color/black" android:visibility="visible" /> <view android:id="@+id/view" android:layout_width="match_parent" android:layout_height="32dp" android:layout_below="@+id/btnfollowedit" android:layout_marginbottom="12dp" android:visibility="invisible" /> <imageview android:id="@+id/main.backcover" android:layout_width="match_parent" android:layout_height="150dp" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparenttop="true" android:fitssystemwindows="true" android:scaletype="centercrop" android:src="@drawable/sea" app:layout_collapsemode="parallax" /> </relativelayout> <android.support.v7.widget.toolbar android:id="@+id/toolbaruser" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/apptheme.popupoverlay"> <textview android:id="@+id/txtnametoolbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="@android:color/white" android:textsize="18sp" /> </android.support.v7.widget.toolbar> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <progressbar android:id="@+id/progressbarmain" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margintop="300dp" /> <android.support.v7.widget.recyclerview android:id="@+id/rvfeeds" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.v4.widget.swiperefreshlayout android:id="@+id/srlcontainer" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v7.widget.recyclerview android:id="@+id/rvuserfeeds" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </android.support.v4.widget.swiperefreshlayout> <de.hdodenhof.circleimageview.circleimageview android:id="@+id/ivuserprofilephoto" android:layout_width="92dp" android:layout_height="92dp" android:layout_margin="@dimen/fab_margin" android:src="@mipmap/ic_launcher" app:civ_border_width="2dp" app:layout_anchor="@id/main.backcover" app:layout_anchorgravity="bottom|left|end" /> </android.support.design.widget.coordinatorlayout> </relativelayout>
what want behavior facebook scroll
on scrolling ]6
try make parent layout android.support.design.widget.coordinatorlayout
set content inside layout check this.
<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:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="192dp" 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:expandedtitlemarginbottom="32dp" app:expandedtitlemarginend="64dp" app:expandedtitlemarginstart="48dp" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:id="@+id/header" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/header" android:fitssystemwindows="true" android:scaletype="centercrop" app:layout_collapsemode="parallax" /> <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:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.collapsingtoolbarlayout> </android.support.design.widget.appbarlayout> <android.support.v7.widget.recyclerview android:id="@+id/scrollableview" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.floatingactionbutton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:clickable="true" android:src="@drawable/ic_action_add" app:layout_anchor="@+id/appbar" app:layout_anchorgravity="bottom|right|end" /> </android.support.design.widget.coordinatorlayout>
Comments
Post a Comment