1

我在我的Android應用程序中遇到問題,我有一個活動與多個碎片裏面。本次活動的佈局是在這裏:Android - 底部導航視圖和導航欄內的片段

<?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" 
    android:id="@+id/drawerlayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/ic_fond_opacite" 
    android:fitsSystemWindows="false"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 
     <FrameLayout 
      android:id="@+id/frame" 
      android:layout_above="@+id/bottomNavigationAvis" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 

     <com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView 
      android:id="@+id/bottomNavigationAvis" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      app:bnv_active_color="@color/vraiment_pro_vert" 
      app:itemBackground="@color/vraiment_pro_fond_gris" 
      app:itemTextColor="@color/vraiment_pro_fond_gris" 
      app:bnv_active_text_size="@dimen/bottom_navigation_text_size_active" 
      app:bnv_colored_background="true" 
      app:bnv_inactive_text_size="@dimen/bottom_navigation_text_size_inactive" 
      app:bnv_with_text="true" /> 
    </RelativeLayout> 
</android.support.v4.widget.DrawerLayout> 

我的問題是,BottomNavigationView沒有我的手機上有一個虛擬導航欄(華爲手機)顯示。但它與我的三星Galaxy S6完美配合。

我直接以爲這是隱藏BottomNavigationview的虛擬導航欄,所以我試圖用代碼here隱藏它。 它表明我是對的,但它不能解決我的問題,因爲我不想隱藏導航欄,它不能永久。

之後,我嘗試在一個簡單的活動中顯示我的BottomNavigationView,它在華爲上工作正常。

所以我認爲這是一個問題發生在片段內,可能是由DrawerLayout或我的代碼中的另一件事引起的?

如果有人已經遇到這個問題,請幫幫我!謝謝 !

回答

0

我還沒有面對同樣的問題,但我發現link人們在討論一些解決方法。此外,我正在使用支持庫BottomNavigationView,我沒有這個問題。如果它不起作用,BottomNavigationView上有一個很好的tutorial帶有Fragments,它最近更新了,它使用了另一個外部庫,這看起來很容易使用。 希望有所幫助!