簡體   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