LinearLayout с v4.widget.DrawerLayout использовать Android - PullRequest
0 голосов
/ 11 марта 2019

Я спроектировал один блок навигации, но не могу применить его к файлу XML, который я сейчас использую.Mainmenu.xml и Activity_main с XML?Заранее благодарю за помощь. Я просто хочу использовать два XML-файла в XML, поэтому мне нужно объединить их.

activity? Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="....firebasedatabase.MainActivity"
    android:orientation="vertical">

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar" />


    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="92dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />




</LinearLayout>

mainmenu.xml

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#fff"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/navigation_header"
        app:itemIconTint="#FF5722"
        app:itemTextColor="#4d4c4b"
        app:menu="@menu/navigation_menu" />

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

1 Ответ

0 голосов
/ 11 марта 2019

Вы используете это:

 <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

используйте это:

 <include
        layout="@layout/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
...