FloatingActionButton (floating button), floatingactionbutton
I. Introduction
This class is inherited from ImageView, so we can use all attributes of ImageView for this control.
2. Prepare for use, and write in the as build. grade File
compile 'com.android.support:design:22.2.0'
Iii. Instructions for use
<android.support.design.widget.FloatingActionButton android:id="@+id/floatingActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@mipmap/ok" app:borderWidth="0dp" app:backgroundTint="#FF4011" app:rippleColor="#33728dff" app:elevation="8dp" app:pressedTranslationZ="16dp" />
We can see that the app attribute is used, and you need to add this attribute to the root container.
xmlns:app="http://schemas.android.com/apk/res-auto"
Attribute introduction:
1. app: borderWidth = "" ------------------ Border width, which is usually set to 0 to solve the problem that the shadow cannot be normally displayed on Android 5.x devices.
2. app: backgroundTint = "" --------------- the background color of the button. If this parameter is not set, the color of col1_cent in theme is used by default.
3. app: rippleColor = "" -------------------- click the edge shadow color
4. app: elevation = "" ---------------------- width of the edge shadow
5. app: pressedTranslationZ = "16dp" ----- when you click a button, the width of the edge shadow of the button is usually greater than that of elevation.
: