Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floating action button and white background

In fact, I search a way to mimic the FAB's inbox. When user press the red button, an opac view and a menu should appear. Because images are more more meaningful, see the following picture

enter image description here

I know it exists this wonderful library (https://github.com/futuresimple/android-floating-action-button) and with this library, i can display floating action menu. But my problem is displaying the white background (with opacity). I didn't find a solution to solve my problem ...

Thx in advance

like image 359
mrroboaat Avatar asked Jan 16 '15 20:01

mrroboaat


People also ask

How do you change the background color of a floating action button?

To change background color of Floating Action Button in Kotlin Android, set the backgroundTint attribute (in layout file) or backgroundTintList property (in Kotlin file) of FAB with the required color.

How do you style 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.


1 Answers

Place the FloatingActionMenu inside FrameLayout that will be on top of other views and will match parent in width and height. Use same margins to lift up and offset from right the menu accordingly.

Set OnFloatingActionsMenuUpdateListener to your floating action menu. Now toggle/replace frame layout background color inside methods:

 @Override
 void onMenuExpanded(){
  mFrameLayoutWrapper.setBackgroundColor(mAlpaWhite);
  }

  @Override
  void onMenuCollapsed(){
    mFrameLayoutWrapper.setBackgroundColor(Color.TRANSPARENT);
  }
like image 53
Nikola Despotoski Avatar answered Sep 29 '22 19:09

Nikola Despotoski