Android Design Support之scroll 初探
来源:互联网 发布:java加密算法有哪些 编辑:程序博客网 时间:2024/05/16 08:59
step1
将ScrollView 替换为NestedScrollView
step2
在想要同样效果的控件加上属性app:layout_scrollFlags=”scroll|enterAlways”即可
layout=”@layout/app_bar_drawer”
<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.faith.smile.copy.drawer"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" /> <android.support.design.widget.TabLayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollFlags="scroll|enterAlways"> </android.support.design.widget.TabLayout> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_drawer" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /></android.support.design.widget.CoordinatorLayout>
layout=”@layout/content_drawer”
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.faith.smile.copy.drawer" tools:showIn="@layout/app_bar_drawer"> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" />v <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button3" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button4" /> </LinearLayout> </android.support.v4.widget.NestedScrollView></RelativeLayout>
0 0
- Android Design Support之scroll 初探
- Android Design Support Library初探-更新中
- Android Design Support Library初探,NavigationView实践
- Android Design Support Library初探,NavigationView实践
- Android Support Design之Snackbar
- Android Support Design 之 CoordinatorLayout
- Android Support Design 中 CoordinatorLayout 与 Behaviors 初探
- Android Support Design 中 CoordinatorLayout 与 Behaviors 初探
- 【Support Design】CoordinatorLayout 初探索
- Android Design Support Library之TabLayout
- Android Design Support Library之CoordinatorLayout,AppBarLayout
- Android Support Design Library之CoordinatorLayout
- Android Support Design Library之NavigationView
- Android Support Design Library之FloatingActionButton
- Android Support Design Library之TabLayout
- Android Support Design Library之TextInputLayout
- Android Support Design Library之NavigationView
- Android Design Support Library实践之Snackbar
- Problem F: 在有序数组中插入数据
- 关于一道题目解法
- hdu 3555 Bomb(数位dp初学)
- 设计模式之单例模式(线程安全)
- 简易四则运算计算器(C51单片机实现)
- Android Design Support之scroll 初探
- 窗口的布局
- 神经网络与机器学习之开篇
- 第六周【项目1-分数类的雏形】
- Java并发学习之十七——线程同步工具之CountDownLatch
- PHP练手:比赛报名系统(一)实现简单单入口
- LaTex调整表格行高——minipage和vspace
- 【bzoj1927】【SDOI2010】【星际竞速】【费用流】
- 树的子结构