如何将高程(阴影)添加到我的BottomNavigationView中.它不是默认情况下 [英] How do I add elevation (shadow) to my BottomNavigationView. It doesn't come by default

查看:183
本文介绍了如何将高程(阴影)添加到我的BottomNavigationView中.它不是默认情况下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过xml和以编程方式设置xml的海拔高度.但没有任何效果.

I tried setting elevation from xml and programmatically both. But nothing works.

推荐答案

仅当您在BottomNavigationView中将android:background设置为白色时,该方法才有效.

It only works if you set white as android:background in the BottomNavigationView.

这是我的代码,并且可以正常工作:

This is my code and it's working:

<android.support.design.widget.BottomNavigationView
    android:id="@+id/bottom_navigation"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="@color/white"
    app:elevation="8dp"
    app:itemIconTint="@color/bottom_color_state"
    app:itemTextColor="@color/bottom_color_state"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="0.52"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/bottom_navigation_main" />

这篇关于如何将高程(阴影)添加到我的BottomNavigationView中.它不是默认情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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