Android - 底部导航视图和导航栏内的片段

问题描述:

我在我的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或我的代码中的另一件事引起的?

如果有人已经遇到这个问题,请帮帮我!谢谢 !

我还没有面对同样的问题,但我发现link人们在讨论一些解决方法。此外,我正在使用支持库BottomNavigationView,我没有这个问题。如果它不起作用,BottomNavigationView上有一个很好的tutorial带有Fragments,它最近更新了,它使用了另一个外部库,这看起来很容易使用。 希望有所帮助!