我是靠谱客的博主 开心宝马,这篇文章主要介绍Android 5.0新控件——FloatingActionButton(悬浮按钮)Android 5.0新控件——FloatingActionButton(悬浮按钮),现在分享给大家,希望可以做个参考。
Android 5.0新控件——FloatingActionButton(悬浮按钮)
FloatingActionButton是5.0以后的新控件,一个悬浮按钮,之所以叫做悬浮按钮,主要是因为自带阴影属性,看上去像是悬浮的而已,其实就可以简单理解成一个带有阴影效果的Button。
效果图
使用
使用方法和Button一样
有的文章说FloatingActionButton在5.x版本上有Bug,没有阴影效果,我个人理解是因为SDK版本不同,对应效果也有所不同,而不是Bug,如果非想要5.x的系统显示4.x效果,可以看下相关的文章。
导入SDK
用前先导入依赖
复制代码
1
compile 'com.android.support:design:23.1.1'
布局
复制代码
1
2
3
4
5
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_dialog_email" />
最后
以上就是开心宝马最近收集整理的关于Android 5.0新控件——FloatingActionButton(悬浮按钮)Android 5.0新控件——FloatingActionButton(悬浮按钮)的全部内容,更多相关Android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复