Android layout 工具栏与我的片段重叠(多窗格)

Android layout 工具栏与我的片段重叠(多窗格),android-layout,android-fragments,android-activity,Android Layout,Android Fragments,Android Activity,我试图在活动的水平方向上同时显示两个片段以及一个工具栏。但工具栏与片段重叠。我不知道放在哪里。顺便说一句,工具栏带有导航视图,因此它位于抽屉布局中 这是我的xml <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:

我试图在活动的水平方向上同时显示两个片段以及一个工具栏。但工具栏与片段重叠。我不知道放在哪里。顺便说一句,工具栏带有导航视图,因此它位于抽屉布局中

这是我的xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


    <LinearLayout
        android:id="@+id/main_content_fragments"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <android.support.v7.widget.Toolbar
            android:id="@+id/main_app_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

        <fragment
            android:id="@+id/activity_fragment_main_event_list"
            class="com.torneyo.torneyoadmin.fragments.EventListFragment"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <fragment
            android:id="@+id/activity_fragment_main_event_detail"
            class="com.torneyo.torneyoadmin.fragments.EventDetailFragment"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="3"
            android:background="?android:attr/detailsElementBackground" />

    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/main_drawer"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:itemIconTint="@color/colorAccent"
        app:itemTextColor="@color/colorTextSecondary"
        app:menu="@menu/menu_drawer" />


</android.support.v4.widget.DrawerLayout>

想法?我需要让碎片出现。我不确定我是否正确使用了布局


谢谢

您好,我看到了您的布局文件。我认为这里面有问题。它应该位于相对布局的内部。请参阅下面修改的布局版本。如果你有任何疑问,请联系我

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <android.support.v7.widget.Toolbar
            android:id="@+id/main_app_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:background="@color/colorPrimary"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

        <LinearLayout
            android:id="@+id/main_content_fragments"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/main_app_toolbar"
            android:orientation="horizontal">

            <fragment
                android:id="@+id/activity_fragment_main_event_list"
                class="com.torneyo.torneyoadmin.fragments.EventListFragment"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1" />

            <fragment
                android:id="@+id/activity_fragment_main_event_detail"
                class="com.torneyo.torneyoadmin.fragments.EventDetailFragment"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:background="?android:attr/detailsElementBackground" />

        </LinearLayout>
    </RelativeLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/main_drawer"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:itemIconTint="@color/colorAccent"
        app:itemTextColor="@color/colorTextSecondary"
        app:menu="@menu/menu_drawer" />


</android.support.v4.widget.DrawerLayout>