FloatingActionButton (floating button), floatingactionbutton

Source: Internet
Author: User

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.

 

:

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.