【发布时间】:2017-11-30 06:47:31
【问题描述】:
我对 CoordinatorLayout 和工具栏的行为有疑问。 像往常一样,我想通过滚动隐藏/显示工具栏。它工作正常。但如果我扔在工具栏本身上,它将独立于 recyclerView 或其他所有东西隐藏。 如何通过触摸工具栏本身来防止工具栏隐藏/显示行为。
这是解释我的问题的视频。 https://youtu.be/3bFcy2SF3Nk
这里的更多信息是我的布局文件中的 sn-p
<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:background="@color/white">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_height"
android:background="@color/white"
app:contentInsetStart="0dp"
app:layout_scrollFlags="scroll|enterAlways|snap">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/padding"
android:src="@drawable/logo_dark" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<FrameLayout
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/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
【问题讨论】:
标签: android material-design toolbar appbar