app:fabSize=“normal”
android:src="@drawable/ic_menu_compose"
app:layout_anchor="@id/listview"
app:layout_anchorGravity=“bottom|right”
app:pressedTranslationZ=“10.0dip”
app:rippleColor="@color/colorfabclick"
/>
android:src:FAB中显示的图标.
app:backgroundTint:正常的背景颜色 ,这里是在values的colors.xml中引用
app:rippleColor:按下时的背景颜色
app:elevation:正常的阴影大小
app:pressedTranslationZ:按下时的阴影大小
app:layout_anchor:设置FAB的锚点,即以哪个控件为参照设置位置,我在上面设置了listview,所以以 listview为锚点,且父类布局须为CoordinatorLayout
app:layout_anchorGravity:FAB相对于锚点的位置,
app:fabSize:FAB的大小,这里设normal,没试过mini
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:id="@+id/coordinator1">
<ListView
android:id="@+id/listview"
android:layout_height=“match_parent”
android:layout_width=“match_parent”
/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_margin=“20.0dip”
app:backgroundTint="@color/colorfab"
app:elevation=“5.0dip”
app:fabSize=“normal”
android:src="@drawable/ic_menu_compose"
app:layout_anchor="@id/listview"
app:layout_