Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a submenu for Floating Action Button in Android Material Design?

I want to create a submenu after click in my floating action button like this :

SubMenu Fab

I already know this Library :

https://github.com/futuresimple/android-floating-action-button

But I want to create this with the native FAB of android support design :

compile 'com.android.support:design:23.+'

and

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="end|bottom"
    android:src="@drawable/ic_add" />
like image 663
lopez.mikhael Avatar asked Oct 09 '15 09:10

lopez.mikhael


People also ask

How do you implement a floating action button?

Add the floating action button to your layoutThe 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.

Are floating action buttons accessible?

The FloatingActionButton is accessible by screen readers and provides WAI-ARIA, Section 508, WCAG 2.1, and keyboard support. The Accessibility is part of Kendo UI for jQuery, a professional grade UI library with 110+ components for building modern and feature-rich applications.

How do I change the shape of the floating action button on Android?

To change the shape of the Floating action button: You can use the shape property of FloatingActionButton() widget class. Implement BeveledRectangleBorder( ) on this property. The output will be a square floating action button, increase the border-radius value to make a circular type shape.


1 Answers

It is not possible directly. android.support.design.widget.FloatingActionButton is a subclass of ImageView and it can't host children. You have to implement your own ViewGroup (a Vertical LinearLayout should be enough) and put the FloatingActionButton into it

like image 138
Blackbelt Avatar answered Sep 26 '22 02:09

Blackbelt