简单代码实现向上滑动隐藏标题栏
2015-12-30 14:15
501 查看
首先加依赖
[code] compile "com.android.support:design:22.2.1"
然后在布局里面写,就能实现了
[code]<RelativeLayout 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:fitsSystemWindows="true"> <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> //这里放内容 </android.support.v4.widget.NestedScrollView> <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/bar_height" android:background="@drawable/bg" android:minHeight="@dimen/bar_height" app:layout_scrollFlags="scroll|enterAlways" > <TextView android:textColor="@color/white" android:text="标题" android:textSize="17sp" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout> </android.support.design.widget.CoordinatorLayout> </RelativeLayout>
相关文章推荐
- 从头认识java-15.7 Map(1)-使用数组来简单模拟Map的创建
- C/C++语言中struct的深入探讨
- java相关类型知识学习
- php框架学习方法---玩对应的项目
- 九个很有用的php功能
- 利用Google Earth卫星图更新地形图地物
- java中map,list一些知识点的总结
- (一)GPIO 编程实验 LED 流水灯控制
- python--文件处理范例
- [LeetCode]题解(python):088-Merge Sorted Array
- Java和js时间格式化
- Java JDK源码
- Python标准库10 多进程初步 (multiprocessing包)
- Spring使用xml配置bean,主要是constructor-arg
- 时间戳转换为时间格式
- 笨方法学Python(11-15)
- Spring文件上传配置
- Java常用工具类总结(二)
- php分页类学习
- IComparable与IComparer