How to disable RecyclerView Items from clicking

后端 未结 9 901
迷失自我
迷失自我 2020-12-31 04:00

I am using Floating Action Button. I want to disable Recyclerview Items from Clicking when i press FAB button. I tried this method but not working setClickable(true);<

9条回答
  •  无人及你
    2020-12-31 04:46

    1. In the xml file, set the layout_width and layout_height for FloatingActionMenu as match_parent and set clickable as false :

          android:layout_width="match_parent "
          android:layout_height="match_parent "
          android:clickable="false"
      
    2. In your java class,

      floatMenu.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
              @Override
              public void onMenuToggle(boolean opened) {
                  if (opened) {
                     floatMenu.setClickable(true);
                  } else {
                       floatMenu.setClickable(false);
                  }
              }
          });
      

    This should work.

提交回复
热议问题