java如何实现像playstore应用程序那样的向下滚动隐藏操作栏?
如何实现像play store应用程序那样的向下滚动隐藏操作栏? 有任何参考项目(github或任何)或提示吗
这是我的基本活动代码,包含了动作条和片段
<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent">
<RelativeLayout
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:background="#F44336"
安卓:id="@+id/toolbarrel">
<安卓.support.v7.widget.Toolbar
安卓:id="@+id/toolbar"
安卓:layout_width="match_parent"
安卓:layout_height="wrap_content"
安卓:background="?attr/colorPrimary"
安卓:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<com.quinny898.library.persistentsearch.SearchBox
安卓:layout_width="wrap_content"
安卓:id="@+id/searchbox"
安卓:layout_height="wrap_content"
安卓:visibility="gone"
安卓:elevation="3dp"
安卓:background="#F44336"
安卓:layout_alignParentLeft="true"
安卓:layout_alignParentTop="true" />
</RelativeLayout>
<FrameLayout
安卓:layout_below="@id/toolbarrel"
安卓:id="@+id/frame_container"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent">
</FrameLayout>
</RelativeLayout>
# 1 楼答案
尝试使用协调器布局
CoordinatorLayout扩展了谷歌实现许多材料设计滚动效果的能力。目前,该框架中提供了几种方法,允许它在不需要编写自定义动画代码的情况下工作
有关Handling Scrolls with CoordinatorLayout的更多信息