Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Floating Action Button options Menu

enter image description here

There are lots of custom libraries for achieving the FAB menu thing. But I want it to be done without using any custom libraries. I want to achieve this FAB Menu natively.

Please don't suggest me any custom library

like image 343
asad.qazi Avatar asked Oct 05 '15 08:10

asad.qazi


People also ask

How do I add icons to the floating action button?

Add the floating action button to your layout The size of the FAB, using the app:fabSize attribute or the setSize() method. The ripple color of the FAB, using the app:rippleColor attribute or the setRippleColor() method. The FAB icon, using the android:src attribute or the setImageDrawable() method.

How do I create an expandable floating action button on fab menu?

Designing Custom Expandable FAB After creating a new Android project, go to the drawable folder and import drawable icons from vector assets. These icons will be placed at the center of the FAB. To add icons, right-click on drawable , select new , then select Vector Asset and choose an icon from Clip Art .

What is a floating action button in Android?

A floating action button (FAB) is a circular button that triggers the primary action in your app's UI. This page shows you how to add the FAB to your layout, customize some of its appearance, and respond to button taps.


1 Answers

You can go for android's design library. add this gradle in to your build file

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

and follow this link, which is a stackoverflow link tells how to use. and this is the link of an sample app.

Example :

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

you can create multiple fab and play with its visibility

UPDATE

I think you have to use third party library to do this. please go through this library, this might help you

like image 134
droidev Avatar answered Oct 05 '22 03:10

droidev