Floating Action Button blocking other components

The new Material Design of Google recommends to use floating action buttons to draw attention to the user for the main action on that screen. There are quite a lot of examples of this within a list view.

Now, suppose your list view has just enough items to fill the screen, making scrolling impossible. If your list items have a certain component that the user can interact with, for example a switch or a favorite star, its possible that the floating action button is blocking this component. How should we handle this case?

  • Right way to format date with strings like today, yesterday, tomorrow etc
  • OnClickListener of Child preventing the swipe of Android ViewPager
  • Create custom ROM in Android
  • Awful background image quality in Android
  • httpurlconnection is very slow on Android 4.2
  • EDIT: This actually always happens with the last item in your list

    Related posts:

    android 5.0 material design tabs
    Crouton depends on libraries but is not a library itself
    How to get the icon of other applications (Android)
    Exception in loading layout: java.util.LinkedHashMap.eldest()Ljava/util/Map$Entry;
    Using “android:textAppearance” on TextView/EditText fails, but “style&...
    match_parent not working for ListView, if ListView is inside NestedScrollView
  • Android: how to select texts from webview
  • How to open a PDF via Intent from SD card
  • Which Android Data Storage Technique to use?
  • How to respect network use settings in Android
  • How to create method for age calculation method in android
  • Genie Effect Animation in Android
  • 5 Solutions collect form web for “Floating Action Button blocking other components”

    Add a blank View with the same height as floating button in footer of list. So when you scroll your list, last item will come up and floating button will not hide last item of list. This is a simple and quick solution.

    I just had this issue now, and I solved it this way:

    public void addBlankSpace(ListView listView)
        Space space = new Space(listView.getContext());

    And I guess there is always a better way. like checking if you even need it. and only then to display it. but for now, this simple code works just fine.

    And here is the conversion function:

    public static int dpToPx(int dp)
        return (int)(dp * Resources.getSystem().getDisplayMetrics().density);

    Or we can just add some padding:

    listView.setPadding(0, 0, 0, Core.dpToPx(50));

    While loading the list, You can create a flag and find if the item in the list is last visible item in the screen,than hide the floating button.

    use this to find last visible item

    int currentPosition = list.getLastVisiblePosition();

    You will get the last number of the item.i.e if 7th item is last visible in your list,than it will return value of currentPosition = 7;

    Once you get the number of items that fit in your screen,Now check for the flag

    if(listAdapterItemsArray.get(position) == currentPosition) {
        //hide button
    } else {

    You can set the position of google action button to left top using


    This way it looks good and doesn’t hide anything.

    i just do what i think the google gmail app is doing and add padding to the recyclerView (or listview).

    android:paddingBottom="100dp" />
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.