Android 中FloatingActionButton(懸浮按鈕)實(shí)例詳解
Android 中FloatingActionButton(懸浮按鈕)實(shí)例詳解
一、介紹
這個(gè)類是繼承自ImageView的,所以對(duì)于這個(gè)控件我們可以使用ImageView的所有屬性
二、使用準(zhǔn)備, 在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屬性,則需要在根容器中添加這個(gè)屬性。
xmlns:app=http://schemas.android.com/apk/res-auto
屬性介紹:
1、app:borderWidth=""------------------邊框?qū)挾?,通常設(shè)置為0 ,用于解決Android 5.X設(shè)備上陰影無法正常顯示的問題
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)文章
Android計(jì)時(shí)器chronometer使用實(shí)例講解
這篇文章主要為大家詳細(xì)介紹了Android計(jì)時(shí)器chronometer使用實(shí)例,介紹了Android計(jì)時(shí)器chronometer基本使用方法,感興趣的小伙伴們可以參考一下2016-04-04
Android應(yīng)用開發(fā)中自定義ViewGroup視圖容器的教程
這篇文章主要介紹了Android應(yīng)用開發(fā)中自定義ViewGroup視圖容器的教程,重點(diǎn)在于View之間的參數(shù)傳遞,文中還講到了使用ViewDragHelper自定義ViewGroup的方法,需要的朋友可以參考下2016-04-04
Android使用OKHTTP解析JSON數(shù)據(jù)的實(shí)例代碼
本篇文章主要介紹了Android使用OKHTTP解析JSON數(shù)據(jù)的實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07
Android自定義viewGroup實(shí)現(xiàn)點(diǎn)擊動(dòng)畫效果
這篇文章主要介紹了Android自定義viewGroup實(shí)現(xiàn)點(diǎn)擊動(dòng)畫效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-12-12
android自定義ListView實(shí)現(xiàn)底部View自動(dòng)隱藏和消失的功能
本篇文章主要介紹了android自定義ListView實(shí)現(xiàn)底部View自動(dòng)隱藏和消失的功能 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-03-03
Flutter利用ORM框架管理數(shù)據(jù)庫(kù)詳解
使用?ORM?框架最大的好處是簡(jiǎn)化了數(shù)據(jù)庫(kù)維護(hù)的代碼量,使得我們可以專注于業(yè)務(wù)代碼實(shí)現(xiàn)。本篇,我們看看如何使用ORM框架管理數(shù)據(jù)庫(kù)版本遷移,需要的可以參考一下2023-04-04
Android APP之WebView校驗(yàn)SSL證書的方法
這篇文章主要介紹了Android APP之WebView校驗(yàn)SSL證書的方法,需要的朋友可以參考下2017-09-09
android實(shí)現(xiàn)widget時(shí)鐘示例分享
這篇文章主要介紹了android實(shí)現(xiàn)widget時(shí)鐘示例,需要的朋友可以參考下2014-03-03
Android Button的基本用法詳解及簡(jiǎn)單實(shí)例
這篇文章主要介紹了Android Button的基本用法詳解及簡(jiǎn)單實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-02-02
通過FancyView提供 Android 酷炫的開屏動(dòng)畫實(shí)例代碼
這篇文章主要介紹了通過FancyView提供 Android 酷炫的開屏動(dòng)畫的實(shí)現(xiàn)代碼,需要的朋友可以參考下2017-12-12

