2017-03-03 77 views
2

當我啓動我的應用程序時,所有其他UI組件都獲得了它們的特定高程,但BottomNavigationView卻不在我的BottomNavigationView上。仰角在BottomNavigationView上不起作用

這裏的XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <FrameLayout 
     android:id="@+id/main_container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/bottom_navigation" 
     android:layout_alignParentTop="true"> 
    </FrameLayout> 

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

</RelativeLayout> 

我能做些什麼?

注意:沒有顏色是透明的。

+0

將'android:background'屬性添加到BottomNavigationView並查看它是否有效 –

+0

仍然沒有變化 – Ale4303

+0

具有相同的問題。你找到解決方案嗎? @ Ale4303 –

回答

1

你應該使用的命名空間xmlns:app="http://schemas.android.com/apk/res-auto"和使用app:elevation = "8dp"代替android:elevation="8dp"

0

影子件被向下拉動(從視圖的底部),你可以看到android:elevation="8dp"應用,如果你試圖表明Snackbar,你贏了無法看到它。

如果要添加將從BottomNavigationView的頂部顯示的陰影,則需要將其繪製爲manually