Fullmetal99012
Fullmetal99012

Reputation: 301

Floating Action Button still appearing on scroll even in ActionMode

I am using Google's Support Design Library for the FloatingActionButton, along with a CoordinatorLayout, RecyclerView, and CardView.

Everything works rather well, with the FAB disappearing on scroll and reappearing when the scroll ends.

I have one small issue however, and that is when I switch the recyclerview into multiselect mode. The FAB dissapears whenever the action mode is set, however scrolling the list view makes it reappear. Is there anyway to set the behavior for the FAB so that when the recycler view is in action mode(multiple selection), the FAB will not reappear when scrolling.

Upvotes: 0

Views: 651

Answers (1)

Aritra Roy
Aritra Roy

Reputation: 15615

There might be other ways to do this, but the most simplest way would be to set the visibility of the FAB to "invisible" in the onCreateActionMode() and back to "visible" in the onDestroyActionMode().

public boolean onCreateActionMode(ActionMode mode, Menu menu) {
 ... 
 fab.setVisibility(View.INVISIBLE);
 ...
 }

public boolean onDestroyActionMode(ActionMode mode) {
 ... 
 fab.setVisibility(View.VISIBLE);
 ...
 }

There is no way the FAB will show up in while the CAB is on. Hope this helps.

Upvotes: 1

Related Questions