Android: onBackPressed() not being called when navigation drawer open

前端 未结 8 1907
粉色の甜心
粉色の甜心 2021-02-05 05:54

I have a main activity that is situated with two navigation drawers. The left one is always accessible, but the right one is used for displaying some necessary lists and perform

8条回答
  •  不思量自难忘°
    2021-02-05 06:32

    I know it is a bit late but still... this answer will help others

    @Override
    public void onBackPressed()
    {
      if (mDrawerLayout.isOpen())
      mDrawerLayout.close();
    else
      super.onBackPressed();
    }
    

提交回复
热议问题