如何将高程设置为底部导航 [英] How to set elevation to Bottom navigation

查看:74
本文介绍了如何将高程设置为底部导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以按support V25.我们有一个称为底部导航"的新组件.

So by the support V25. We have new component called Bottom navigation.

按照设计指南,底部导航的elevation应该为8dp( https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-specs )

Follow the Design guidelines, the Bottom Navigation's elevation should be 8dp (https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-specs)

但是我不能将它设置为elevation.

But I can't set the elevation to it.

任何建议,示例将不胜感激.谢谢!

Any suggestion, example would be appreciated. Thank you!

更新XML代码

<RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent">

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

<FrameLayout
    android:id="@+id/contentFrame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/bottom_navigation"
    android:background="#EDEDED"/>

推荐答案

因此,就目前而言(25.1.0),我们必须将BNV的android:background设置为@android:color/white以获得阴影.如果您设置为其他颜色(即原色),则不会显示

So, for now (25.1.0) we have to set the android:background of BNV to @android:color/white to have the shadow. It will not display if you set to other color (ie your primary color)

这篇关于如何将高程设置为底部导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆