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 fo
I achieved the effect you just mentioned by the following method. I just added a view behind the floating button and above the other layouts, and keep the view visibility GONE, until the menu is expanded. Then i set the view visibility to VISIBLE. And yes i set the background of the view to any opaque color you want.
My code
My XML file
And at the Activity or Fragment where the FloatingButtons are handled
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
setFloatingButtonControls();
}
private void setFloatingButtonControls(){
this.bckgroundDimmer = findViewById(R.id.background_dimmer);
this.floatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.multiple_actions);
this.floatingActionsMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuExpanded() {
bckgroundDimmer.setVisibility(View.VISIBLE);
}
@Override
public void onMenuCollapsed() {
bckgroundDimmer.setVisibility(View.GONE);
}
});
}
This will give the effect you wanted. Hope this helps. It sure helped me. :)