In an application I am just starting, I have a RecyclerView. I used the following code to hide the toolbar when scrolling through the RecyclerView:
app:layout_scrollFlags="scroll|enterAlways"
When scrolling, the toolbar moves but it's text slides into the notification tray instead of disappearing.
At the top of the image in the notification tray it says HarHar and then shows the settings button at the end.
An example of this is:
Image of toolbar in notification tray
The code for the toolbar is:
<?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:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.harhar.harhar.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" app:layout_scrollFlags="scroll|enterAlways" /> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_main" /> <android.support.v4.view.ViewPager android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="match_parent"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerList" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" />` </android.support.design.widget.CoordinatorLayout>
If anyone could help I would truly appreciate it. Thank you.
if (canHelpMe()){ eternallyGrateful(); }else if(needExtraInformation()){ letMeKnow(); }else{ reallySad(); }
No comments:
Post a Comment