如何在同一应用程序中创建导航抽屉和底部栏 [英] How to create a Navigation Drawer and Bottom Bar in the same app

查看:108
本文介绍了如何在同一应用程序中创建导航抽屉和底部栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,我想在该应用程序中有一个导航抽屉和一个底部栏.

I am creating an app, and I want to have a Navigation Drawer and a Bottom Bar in the app.

我认为这是一个很好的方法,但是当我显示导航抽屉时,我可以做到这一点,它不在底部栏的上方,而是在底部,所以该怎么办?我需要底部栏的导航抽屉.

I think that I am going for a good way, but I Can do that the Navigation Drawer when I display it, this is not above the Bottom Bar, it is behind, so How can I do it? I need the Navigation Drawer up of the Bottom Bar.

这是我的代码,希望您能帮助我,谢谢n.n

This is my code, I hope you can help me, thanks n.n

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent">


    <android.support.v4.widget.DrawerLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

   <include
          layout="@layout/include_list_viewpager" />-

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_height="match_parent"
        android:layout_width="300dp"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header"
        app:menu="@menu/drawer_view" />

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


  <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/colorPrimaryRed"
        app:itemTextColor="@drawable/nav_item_color_state"
        app:itemIconTint="@drawable/nav_item_color_state"
        app:menu="@menu/navigation" />


</RelativeLayout>

推荐答案

<?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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
    <include
       ----- text showing -----/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimary"
        app:itemTextColor="@color/colorAccent"
        app:itemIconTint="@color/colorWhite"
        app:menu="@menu/bottom_navigation_item"/>
</RelativeLayout>

<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:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" />

这篇关于如何在同一应用程序中创建导航抽屉和底部栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆