Я пытаюсь сделать Toolbar
в своем приложении, скрывать и показывать на основе прокрутки RecyclerView
. Этот gif показывает, чего я пытаюсь достичь.Панель инструментов не скрывается на прокрутке RecyclerView
Я следую this tutorial и не получить результаты, я ищу. Вот макет моей деятельности в:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:fitsSystemWindows="true">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF" />
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/header"
app:menu="@menu/drawer" />
</android.support.design.widget.CoordinatorLayout>
И вот
Toolbar
расположение:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@color/ColorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
Когда я запускаю этот код, то Toolbar
полностью исчезает. Что не так?
взгляните на это https://mzgreen.github.io/2015/02/28/How-to-hideshow-Toolbar-when-list-is-scrolling%28part2%29/ –
Я бы хотел следуйте учебному пособию по Части 3, потому что я скоро буду реализовывать FAB. @SanketKachhela – wasimsandhu
То же самое здесь. У меня есть почти такая же структура в моем приложении и следуют одному и тому же учебнику, но панель инструментов не будет скрываться в прокрутке. Я дам вам знать, смогу ли я это обработать – ThanosFisherman