繁体   English   中英

底部栏导航和同一应用程序中的导航抽屉

[英]Bottom bar navigation and Navigation drawer in same app

我在我的应用程序中使用rawike底部栏导航。现在,我也在尝试添加导航抽屉,并在我的应用程序中同时使用两者。当我运行显示logow错误的代码logcat时,该如何解决?

记录猫错误

FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.app.testfragments/com.android.app.testfragments.MainActivity}: android.view.InflateException: Binary XML file line #59: Error inflating class com.roughike.bottombar.BottomBar

Activity_main.xml

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
 <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
<LinearLayout
            android:id="@+id/container_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
 <include
                android:id="@+id/toolbar"
                layout="@layout/toolbar" />
        </LinearLayout>
<FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
</LinearLayout>
 <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#FFFFFF"
        android:choiceMode="singleChoice"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="1dp" />
<FrameLayout
        android:id="@+id/contentContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottomBar" />
<com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentBottom="true"
        app:bb_tabXmlResource="@xml/bottombar_tabs" />
</android.support.v4.widget.DrawerLayout>

可能是您的磁带库未正确安装

您可以使用Android Studio提供的底部导航栏活动 在此处输入图片说明

如下所示,在CoordinatorLayout中使用BottomBar

<?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_content"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true">

    <!--<include layout="@layout/content_potential_tenant" />-->

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/coordinator_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/fragment_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <!--This is where the fragment will be placed-->

        </FrameLayout>

        <com.roughike.bottombar.BottomBar
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_gravity="bottom"
            android:background="@color/navigationItemBackground"
            app:bb_tabXmlResource="@xml/associated_tenant_bottombar_menu"
            app:bb_behavior="underNavbar|shy"/>

    </android.support.design.widget.CoordinatorLayout>

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM