Navigation Drawer doesn't show fragments

后端 未结 2 930
旧巷少年郎
旧巷少年郎 2021-01-26 15:37

I\'ve created a new Android Studio Project and my MainActivity is a Navigation Drawer Activity.

So, I can\'t show up fragments. I\'ve read many post on internet and here

2条回答
  •  囚心锁ツ
    2021-01-26 16:04

    Make the drawer's list in Your activity and add setOnItemClickListener().When the user selects an item in the drawer's list, the system calls onItemClick() on the OnItemClickListener given to setOnItemClickListener().

    What you do in the onItemClick() method depends on how you've implemented your app structure. In the following example, selecting each item in the list inserts a different Fragment into the main content view (the FrameLayout element identified by the R.id.content_frame ID): for more delail please read these articles youtube and github example

提交回复
热议问题