如何在android中将抽屉布局添加到my mainActivity.xml

如何在android中将抽屉布局添加到my mainActivity.xml,android,fragment,drawerlayout,Android,Fragment,Drawerlayout,现在,我的mainActivity.xml文件如下所示: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

现在,我的mainActivity.xml文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="#FFFFFF"
              android:orientation="vertical">

    <include layout="@layout/title_bar" />
    <FrameLayout android:id="@+id/tab_content"
                 android:layout_width="match_parent"
                 android:layout_height="0dp"
                 android:layout_weight="1" />

    <include layout="@layout/bottom_bar" />

</LinearLayout>

此页面底部有四个选项卡,每个选项卡都与一个不同的片段相关联,该片段将添加到android:id=“@+id/tab_content”


以下是我的问题,如何将抽屉布局添加到mainActivity.xml,并且只允许第一个片段打开抽屉布局。

检查此项,感谢您推荐的帖子,但解决方案允许所有选项卡都具有抽屉布局功能?我只需要第一个片段就可以打开抽屉布局。