2017-03-03 79 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