How to change fragments using Android navigation drawer

后端 未结 5 1101
忘了有多久
忘了有多久 2020-11-30 22:43

I know these types of question have already been here but still I have not found my answer for this question:

  • I have created an application and used navigatio
5条回答
  •  死守一世寂寞
    2020-11-30 23:10

    You need to create a switch block inside the onNavigationDrawerItemSelected() and use the code that's already there for every case but with corresponding Fragment instead of PlaceholderFragment. Now it contains a generic piece of code for adding a PlaceholderFragment to the layout, reuse it for your purposes.

提交回复
热议问题