Android 中FloatingActionButton(懸浮按鈕)實(shí)例詳解
Android 中FloatingActionButton(懸浮按鈕)實(shí)例詳解
一、介紹
這個(gè)類是繼承自ImageView的,所以對(duì)于這個(gè)控件我們可以使用ImageView的所有屬性
二、使用準(zhǔn)備, 在as 的 build.grade文件中寫上
compile 'com.android.support:design:22.2.0'
三、使用說(shuō)明
<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屬性,則需要在根容器中添加這個(gè)屬性。
xmlns:app=http://schemas.android.com/apk/res-auto
屬性介紹:
1、app:borderWidth=""------------------邊框?qū)挾?,通常設(shè)置為0 ,用于解決Android 5.X設(shè)備上陰影無(wú)法正常顯示的問(wèn)題
2、app:backgroundTint=""---------------按鈕的背景顏色,不設(shè)置,默認(rèn)使用theme中colorAccent的顏色
3、app:rippleColor=""--------------------點(diǎn)擊的邊緣陰影顏色
4、app:elevation=""----------------------邊緣陰影的寬度
5、app:pressedTranslationZ="16dp"-----點(diǎn)擊按鈕時(shí),按鈕邊緣陰影的寬度,通常設(shè)置比elevation的數(shù)值大
效果圖:
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
- Android開發(fā)之FloatingActionButton懸浮按鈕基本使用、字體、顏色用法示例
- Android自定義可拖拽的懸浮按鈕DragFloatingActionButton
- Android中FloatingActionButton實(shí)現(xiàn)懸浮按鈕實(shí)例
- Android仿知乎懸浮功能按鈕FloatingActionButton效果
- Android懸浮按鈕點(diǎn)擊返回頂部FloatingActionButton
- Android開發(fā)懸浮按鈕 Floating ActionButton的實(shí)現(xiàn)方法
- Android實(shí)現(xiàn)懸浮可拖拽的Button
相關(guān)文章
flutter實(shí)現(xiàn)發(fā)送驗(yàn)證碼功能
這篇文章主要為大家詳細(xì)介紹了flutter發(fā)送驗(yàn)證碼功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-07-07ListView實(shí)現(xiàn)下拉動(dòng)態(tài)渲染數(shù)據(jù)
這篇文章主要為大家詳細(xì)介紹了ListView實(shí)現(xiàn)下拉動(dòng)態(tài)渲染數(shù)據(jù)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-06-06Android 動(dòng)態(tài)的顯示時(shí)間
本文給大家分享一段代碼實(shí)現(xiàn)android動(dòng)態(tài)顯示時(shí)間,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧2016-12-12Android 對(duì)Map按key和value分別排序的實(shí)例
下面小編就為大家?guī)?lái)一篇Android 對(duì)Map按key和value分別排序的實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-12-12利用kotlin實(shí)現(xiàn)一個(gè)餅圖實(shí)例代碼
餅狀圖是以不同顏色的圓的切片表示的值。下面這篇文章主要給大家介紹了關(guān)于利用kotlin實(shí)現(xiàn)一個(gè)餅圖的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-12-12Android 用RxBinding與RxJava2實(shí)現(xiàn)短信驗(yàn)證碼倒計(jì)時(shí)功能
這篇文章主要介紹了Android 用RxBinding與RxJava2實(shí)現(xiàn)短信倒計(jì)時(shí)功能示例,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10Android實(shí)現(xiàn)登錄注冊(cè)頁(yè)面(上)
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)登錄注冊(cè)頁(yè)面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-04-04Android5.0+ CollapsingToolbarLayout使用詳解
這篇文章主要為大家詳細(xì)介紹了Android5.0+ CollapsingToolbarLayout使用,感興趣的小伙伴們可以參考一下2016-09-09