2015-10-05 99 views
9

enter image description hereAndroid浮動動作按鈕選項菜單

有很多自定義庫實現FAB菜單的事情。但我希望在不使用任何自定義庫的情況下完成。我想本機地實現這個FAB菜單。

請不要建議我任何自定義庫

+1

目前這個功能不是官方支持FAB。你必須自己實現它或使用一些庫。 – Mangesh

回答

4

你可以去android的設計庫。在此增加的Gradle來構建文件

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

,並按照this鏈接,這是一個計算器的鏈接將告訴您如何使用。和this is示例應用的鏈接。

例子:

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="16dp" 
    android:clickable="true" 
    android:src="@drawable/ic_done" 
    app:layout_anchor="@id/viewA" 
    app:layout_anchorGravity="bottom|right|end"/> 

可以創建多個工廠和其知名度

UPDATE

我認爲你必須使用第三方庫來做到這一點發揮。請經過this庫,這可能幫助你

+4

這不回答問題。 – Mangesh

+1

@MangeshGhotage你有什麼建議呢? – droidev

+0

支持庫幾乎不是一個「自定義」庫。它是爲避免使核心應用程序膨脹而創建的擴展,除非必要。 –

0

添加這種依賴於應用的build.gradle

compile 'com.android.support:design:23.1.0' 
compile 'com.github.clans:fab:1.6.2' 

添加按照下面的鏈接Floating Action Menu