Hide/show Android toolbar on scrolling -
i trying make app tablayout. have expandable list view in first tab , gridview in other 2 tabs.
tablayout_main.xml
<?xml version="1.0" encoding="utf-8"?> <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" tools:context=".activities.homepageactivity"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" > <!--android:background="#072120"--> <!--android:background="@drawable/header_copy--> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:titletextcolor="#fffade09" app:titlemarginstart="100dp" app:titletextappearance="@style/tablayouttextstyle" app:layout_scrollflags="scroll|enteralways|snap" app:popuptheme="@style/apptheme.popupoverlay" > <!--android:background="#ff008080"--> </android.support.v7.widget.toolbar> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabtextcolor="#fffade09" app:tabselectedtextcolor="#f7ffffff" app:tabtextappearance="@style/tablayouttextstyle" /> </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" /> </android.support.design.widget.coordinatorlayout> expandablelistview_tab.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activities.homepageactivity$placeholderfragment"> <imageview android:id="@+id/homepagebggifimageview" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/homepagegif" android:contentdescription="@string/homepagebgdescriptor" /> <textview android:id="@+id/textviewwn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_gravity="center_horizontal|top" android:paddingtop="30dp" android:singleline="false" android:text="@string/welcome_note" android:textappearance="?android:attr/textappearancemedium" android:textcolor="#ecec0c" android:textisselectable="false" android:textsize="26sp" android:visibility="visible" /> <expandablelistview android:id="@+id/listview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textviewwn" android:layout_centerhorizontal="true" android:layout_gravity="center" android:groupindicator="@null" android:padding="20dp" /> </relativelayout> gridview_tab.xml
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activities.homepageactivity$placeholderfragment"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/shoppingbggifimageview" android:background="@drawable/homepagegif" android:contentdescription="@string/homepagebgdescriptor" /> <gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/logogridview" android:layout_width="match_parent" android:layout_height="match_parent" android:numcolumns="auto_fit" android:stretchmode="columnwidth" android:horizontalspacing="10dp" android:verticalspacing="10dp" android:gravity="center" android:paddingbottom="@dimen/appbar_padding_top" android:scrollbars="vertical" android:scrollbarstyle="outsideoverlay" /> </relativelayout> now want achieve if expandablelistview or gridview items more fits in screen on scrolling on listview or gridview, toolbar should hide , show if scrolled down toolbar should visible. functionality in whatsapp. if chat tab has more chats toolbar hides on scrolling chats. want same that.
Comments
Post a Comment