我是靠谱客的博主 开心宝马,最近开发中收集的这篇文章主要介绍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
用前先导入依赖
compile 'com.android.support:design:23.1.1'
布局
<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 5.0新控件——FloatingActionButton(悬浮按钮)Android 5.0新控件——FloatingActionButton(悬浮按钮)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复