Floating Action Button是一种悬浮操作的圆形按钮,继承自ImageView,可以通过android:src或者ImageView的任意方法,来设置FloatingActionButton里面的图标。显示效果如下:

  

  使用方法类似于普通的Button一样,首先在xml文件中声明

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_done" />

  通过指定layout_gravity就可以指定它的位置。或者通过app:layout_anchor="@id/tabs",app:layout_anchorGravity="bottom|right"来确定其显示位置。

  除了一般大小的悬浮操作按钮,它还支持mini size(fabSize=”mini”)。

  通过setRippleColor()方法还可以设置其点击效果。

Android Design Support Library——Floating Action Button的更多相关文章

  1. Android Design Support Library使用详解

    Android Design Support Library使用详解 Google在2015的IO大会上,给我们带来了更加详细的Material Design设计规范,同时,也给我们带来了全新的And ...

  2. 【转】【翻】Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏

    转自:http://mrfufufu.github.io/android/2015/07/01/Codelab_Android_Design_Support_Library.html [翻]Andro ...

  3. Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏

    原文:Codelab for Android Design Support Library used in I/O Rewind Bangkok session--Make your app fanc ...

  4. Codelab for Android Design Support Library used in I/O Rewind Bangkok session

    At the moment I believe that there is no any Android Developer who doesn't know about Material Desig ...

  5. Material Design 开发利器:Android Design Support Library 介绍

    转自:https://blog.leancloud.cn/3306/ Android 5.0 Lollipop 是迄今为止最重大的一次发布,很大程度上是因为 material design —— 这是 ...

  6. Android Design Support Library——Navigation View

    前沿 Android 从5.0开始引入了Material design元素的设计,这种新的设计语言让整个安卓的用户体验焕然一新,google在Android Design Support Librar ...

  7. 如何使用android design support library

    Android应用Design Support Library完全使用实例 - OPEN 开发经验库http://www.open-open.com/lib/view/open143338585611 ...

  8. Android Design Support Library 中控件的使用简单介绍(一)

    Android Design Support Library 中控件的使用简单介绍(一) 介绍 在这个 Lib 中主要包含了 8 个新的 material design 组件!最低支持 Android ...

  9. Material Design with the Android Design Support Library

    Material Design with the Android Design Support Library 原文http://www.sitepoint.com/material-design-a ...

随机推荐

  1. 终极事务处理(XTP,Hekaton)——万能大招?

    在SQL Server 2014里,微软引入了终极事务处理(Extreme Transaction Processing),即大家熟知的Hekaton.我在网上围观了一些文档,写这篇文章,希望可以让大 ...

  2. .Net魔法堂:发个带附件的邮件

    一.前言   由于工作需要最近把邮件发送封装成WebService,现在把代码记录在此,以便日后查阅. 二.二话不说写代码 private void _SendMail(string form, st ...

  3. 转载:第六弹!全球首个微信小程序(应用号)开发教程!通宵吐血赶稿!

    大家好!博卡君原计划是能在国庆假期前把小程序的开发教程做完,给大家一套完整.系统的东西,不过由于最近小程序开发工具的拍照组件尚未完善,很多功能还不能顺利实现.我考虑了一下,觉得不如把拍照部分的一些代码 ...

  4. SQL Server 诊断查询-(1)

    Query #1 is Version Info. SQL and OS Version information for current instance SELECT @@SERVERNAME AS ...

  5. 第二个冲刺 Sprint

    顺带 MY—HR 成员: 角色分配 学号 博客园 团队贡献分 丘惠敏 PM项目经理 201406114203 http://www.cnblogs.com/qiuhuimin/ 19 郭明茵 用户 2 ...

  6. css样式表和选择器的优先级以及position元素属性值的区别

    css样式表优先级 问题:当同一个HTML元素被不止一个样式定义时,会使用哪个样式呢? 答:一般而言,所有的样式会根据下面的规则层叠于一个新的虚拟样式表中,其中数字4拥有最高的优先权. 1.浏览器缺省 ...

  7. 优化win2d实现的萤火虫粒子效果

    前几天我发了个技术博客,告诉大家怎样用Win2D 画萤火虫动画 . 那种绘制萤火虫的方式虽然画质高,但是性能不好,萤火虫数量超过50就可以感受到帧数下降. 我今天想到了一种牺牲画质提升性能的绘制方式, ...

  8. csharp: WebBrowser read baidumap

    setpoint.html: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Typ ...

  9. isEmpty与null、""的区别

    前一段时间我阅读别人的代码,发现有的时候用isEmpty,有的时候用null,有的时候用"".我很困惑三者之间的区别,于是我就自己写了一个程序来验证一下 public class ...

  10. 【背景建模】PBAS

    Pixel-Based Adaptive Segmenter(PBAS)检测算法,是基于像素的无参数模型,该算法结合了SACON和VIBE两个算法的优势,并在这两个算法的基础上改进而来,SACON和V ...