Material Design之一:FloatingActionButton

来源:互联网 发布:linux卸载jdk1.5 编辑:程序博客网 时间:2024/06/01 08:26


     FloatingActionButton是Android 5.0 新特性Material Design中一个简单的控件,它是有ImageButton扩展而来。


一.使用方法很简单,只需添加如下布局:

<android.support.design.widget.FloatingActionButton        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginBottom="30dp"        android:layout_marginRight="30dp"        android:layout_alignParentRight="true"        android:layout_alignParentBottom="true"        android:src = "@drawable/add"        app:elevation="6dp"        app:pressedTranslationZ="12dp"        />

效果如下:


二.属性:

1.android:src

        设置显示的图片


2.app:elevation

       正常显示的时候阴影大小


3.app:pressedTranslationZ

       点击时显示的阴影大小


4.app:backgroundTint

        正常显示的时候的填充色,这个默认取的是theme中的colorAccent,可以在style中定义colorAccent,colorAccent 对应EditText编辑时、RadioButton选中、CheckBox等选中时的颜色。


5.app:rippleColor

       点击的时候的颜色,默认取的是theme中的colorControlHighlight



0 0
原创粉丝点击