Android5.0 FloatingActionButton使用小结
来源:互联网 发布:cdn加速知乎 编辑:程序博客网 时间:2024/06/16 02:30
FloatingActionButton, 这是一个浮动按钮。
1.导入包
compile 'com.android.support:design:22.2.0'
2.常用属性介绍
- app:backgroundTint - 设置FAB的背景颜色。
- app:rippleColor - 设置FAB点击时的背景颜色。
- app:borderWidth -该属性尤为重要,如果不设置0dp,那么在4.1的sdk上FAB会显示为正方形,而且在5.0以后的sdk没有阴影效果。所以设置为borderWidth=”0dp”。
- app:elevation - 默认状态下FAB的阴影大小。
- app:pressedTranslationZ - 点击时候FAB的阴影大小。
- app:fabSize - 设置FAB的大小,该属性有两个值,分别为normal和mini,对应的FAB大小分别为56dp和40dp。
- src - 设置FAB的图标,Google建议符合Design设计的该图标大小为24dp。
- app:layout_anchor - 设置FAB的锚点,即以哪个控件为参照点设置位置。
- app:layout_anchorGravity - 设置FAB相对锚点的位置,值有
bottom、center、right、left、top等。
3.示例
<?xml version="1.0" encoding="utf-8"?><LinearLayout 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:orientation="vertical"> <android.support.design.widget.FloatingActionButton android:id="@+id/floatActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" app:backgroundTint="#eeeeee" app:elevation="2dp" app:fabSize="normal" /></LinearLayout>
0 0
- Android5.0 FloatingActionButton使用小结
- Android5.0之TextInputLayout、FloatingActionButton的使用
- Android5.0之TextInputLayout、FloatingActionButton的使用
- Android5.0之TextInputLayout、FloatingActionButton的使用
- Android5.0 SnackBar使用小结
- Android5.0 TextInputLayout使用小结
- Android5.0 TabLayout使用小结
- android5.0的drawerLayout,toolBar,FloatingActionButton,NavigationView的实现
- 使用FloatingActionButton
- android5.0使用svg
- android5.0源码编译错误小结
- FloatingActionButton的使用
- FloatingActionButton的基础使用
- FloatingActionButton的使用
- FloatingActionButton控件初步使用
- FloatingActionButton的使用
- Android之FloatingActionButton使用
- FloatingActionButton的使用
- 页面中,禁止html内容被选择
- 【iOS开发】Xcode清除最近打开的工程
- JSP--设置性别是否被选中
- 矩阵求逆-Warning: Matrix is singular to working precision.
- 几何画板绘制三棱锥的方法
- Android5.0 FloatingActionButton使用小结
- Lua 学习笔记:沙盒
- 线程等待
- MATLAB常见函数(图像处理方面)
- Bullshit —— 第一期
- JS循环输出数组及数组键值
- 【c语言】scanf和getchar详解
- java 线程3 多线程的基本工作原理
- RDO1.4.7连接windows 2008出现的问题