选项卡 – 尽管实现了所有必需参数,但CoordinatorLayout不会在滚动时隐藏工具栏

这是我的设置,我正在运行DrawerLayout,其中包含一个包含AppBarLayout和nestedscrollview的CoordinatorLayout.我试图让nestedscrollview正常滚动,工具栏在向下滚动时隐藏,并在向上滚动时重新编辑.附在我的 XML代码中.将不胜感激任何帮助..已阅读所有相关问题并实施他们的答案,但没有任何成功.
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout_admin"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/admincoordinator"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include
            android:id="@+id/app_bar"
            layout="@layout/app_bar"
            app:layout_scrollFlags="scroll|enteralways" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.nestedScrollView
        android:id="@+id/adminrelScroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/nav_drawer"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/drawer_header"
    app:menu="@menu/menu_drawer" />

解决方法

我有一个星期的相同问题,并尝试了几乎所有解决它.
但是我设法解决了这个问题.

你有什么……

<include
    android:id="@+id/app_bar"
    layout="@layout/app_bar"
    app:layout_scrollFlags="scroll|enteralways" />

…将其替换为app_bar.xml布局中的任何内容.例如:

<android.support.v7.widget.Toolbar
    android:id="@+id/main_toolbar"
    style="@style/AppTheme.Toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    app:layout_scrollFlags="scroll|enteralways"/>

似乎由于某种原因,使用< include>时使用CoordinatorLayout滚动不起作用标签.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...