FloatingActionButton(懸浮按鈕),floatingactionbutton

來源:互聯網
上載者:User

FloatingActionButton(懸浮按鈕),floatingactionbutton

一、介紹

這個類是繼承自ImageView的,所以對於這個控制項我們可以使用ImageView的所有屬性

二、使用準備, 在as 的 build.grade檔案中寫上

compile 'com.android.support:design:22.2.0'

三、使用說明

<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"        />

可以看到我們使用了app屬性,則需要在根容器中添加這個屬性。 

xmlns:app="http://schemas.android.com/apk/res-auto"

屬性介紹:

1、app:borderWidth=""------------------邊框寬度,通常設定為0 ,用於解決Android 5.X裝置上陰影無法正常顯示的問題

2、app:backgroundTint=""---------------按鈕的背景顏色,不設定,預設使用theme中colorAccent的顏色

3、app:rippleColor=""--------------------點擊的邊緣陰影顏色

4、app:elevation=""----------------------邊緣陰影的寬度

5、app:pressedTranslationZ="16dp"-----點擊按鈕時,按鈕邊緣陰影的寬度,通常設定比elevation的數值大

 

  

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.