首先上代码

xmlns:app="http://schemas.android.com/apk/res-auto"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent">

app:layout_scrollFlags="scroll|enterAlways"

android:fitsSystemWindows="true"

android:layout_width="match_parent"

android:layout_height="wrap_content">

app:layout_scrollFlags="scroll|enterAlways"

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:layout_centerInParent="true"

android:text="我是要隐藏的顶部标题"

android:layout_width="wrap_content"

android:layout_height="wrap_content"/>

app:layout_behavior="@string/appbar_scrolling_view_behavior"

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:text="标题"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

app:layout_behavior="@string/appbar_scrolling_view_behavior"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="vertical">

android:text="我是中间的布局"

android:layout_width="match_parent"

android:layout_height="wrap_content"/>

android:paddingTop="100dp"

android:id="@+id/recycle"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

哪个控件要隐藏就设置app:layout_scrollFlags="scroll|enterAlways"

哪个控件滑动设置  app:layout_behavior="@string/appbar_scrolling_view_behavior"(通知布局中包含滑动组件!)


scroll: 所有想滚动出屏幕的view都需要设置这个flag- 没有设置这个flag的view将被固定在屏幕顶部。

enterAlways:这个flag让任意向下的滚动都会导致该view变为可见,启用快速“返回模式”。

enterAlwaysCollapsed:当你的视图已经设置minHeight属性又使用此标志时,你的视图只能已最小高度进入,只有当滚动视图到达顶部时才扩大到完整高度。

exitUntilCollapsed: 滚动退出屏幕,最后折叠在顶端。

更多相关文章

  1. android 保持屏幕唤醒状态
  2. Android旋转屏幕不销毁数据的方法
  3. 用于做 Android 屏幕自适应的文章资源
  4. 上接系出名门Android(8) - 控件(View)之TextSwitcher, Gallery,
  5. android —— 自定义控件 竖向的ViewPager,上下滑动的组件,android
  6. 【特效】【自定义控件】关键字飘飞效果
  7. 屏幕方向android:screenOrientation
  8. android唤醒屏幕--保持屏幕唤醒-Reprinted
  9. 日期选择控件

随机推荐

  1. android 下拉刷新控件
  2. ViewPager初步用法(二)
  3. ListActivity show List
  4. SurfaceView基本使用
  5. notification android原生消息通知代码详
  6. android路径获取
  7. RecyclerView添加行间距
  8. Java反射
  9. Android实现局域网组播
  10. Common Intents