Navigation drawer - Disable click through on items behind the drawer

前端 未结 6 2153
旧时难觅i
旧时难觅i 2021-02-06 20:34

Is there any way to make sure that the navigation drawer stays on top of the content in the fragment?

I created a small test application with dummy data. 10 fragments w

6条回答
  •  一向
    一向 (楼主)
    2021-02-06 21:09

    Well, I found one solution for this issue. When the drawer is being opened you can bring the nav bar to the front by calling the bringToFront()-method on the layout you use. This makes sure the navigation drawer stays on top of any underlying content until a new item has been selected.

    I.e:

    @Override
    public void onDrawerOpened(View drawerView)
       {
       activity.getActionBar().setTitle("Select content");
       activity.invalidateOptionsMenu();
       drawerLayout.bringToFront();
       }
    

提交回复
热议问题