android悬浮按钮floating action button的两种实现方法_第1页
android悬浮按钮floating action button的两种实现方法_第2页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 UI(UIsetContentView)它更容易在代码中被获取(试想如果你要在 actionbar 中获取一个菜单按钮是不是很难?),Promoted Actions 往往主要用于一个界面的主要操作,比如在 的邮件列表界面,promotedactionpromotedactionpromotedactionFlo tionButton(FAB,FBI)。tion button是androidl中的产物但是使用flotion button代表添加新元素的功能,12要实现12要实现flotion button可以有多种方法,一种只适合androidL,另外ImageButtonandroid L

2、3456789仔细一点,你会发这个 ImageButton 放到了布局的右下角,为了实tion button应该具备的效果,需要考虑以下几个方面ripple drawable 3456789仔细一点,你会发这个 ImageButton 放到了布局的右下角,为了实tion button应该具备的效果,需要考虑以下几个方面ripple drawable 设置成了drawable/ripple,rippledrawable1234567ripple HYPERLINK http:/s/ /apk/res/android 123456789selector HYPERLINK http:/s/ and

3、roid:valueType=floatType 使用属性动画去改变translatioz。android:valueType=floatType 123publicclassCustomFABextendsImageButton123456789privatevoidtrSet).Themetheme=TypedArrayarrandroid:valueType=floatType 123publicclassCustomFABextendsImageButton123456789privatevoidtrSet).Themetheme=TypedArrayarr=theme.obtainS

4、tyledAttributes(attrSet,R.styleable.FAB,0,setBgColor(arr.getColor(R.styleable.FAB_bg_color, Color.BLUE); setBgColorPressed(arr.getColor(R.styleable.FAB_bg_color_pressed,ColSsld=new e_pressed, catch(Throwablet) finally 12345678declare-styleable!-Backgroundcolor-attrname=bg_color attrname=bg_color_pre

5、ssed 12privateDrawablecolor)=new 使用 在xml 然后这种方式不依赖于androidL,而是码代码。3456789Drawable sd =new 1=new Drawable sd1=new3456789Drawable sd =new 1=new Drawable sd1=new sd1.setShaderFactory(newSh publicShaderLinearGradientlgheight)new LinearGradient(0,0,0,null, return LayerDrawableld=new LayerDrawable(new Drawablesd1,sd); ld.setLayerInset(0, 5, 5, 0, 0);ld.setLayerInset(1,0,0,5,return 最后将控件放xml中123456789RelativeLay

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论