0

I want to set backgroundColor as white for bottom navigation view. But there is a top shadow.

enter image description here

I want to change this color. How can I do this?

us2956
  • 426
  • 9
  • 23

3 Answers3

2

It is not possible to change the colour of elevation shadow provided by the framework but you can use the library to do so, please refer Lib

Check this too

DKV
  • 1,804
  • 3
  • 27
  • 49
0

Try setting app:elevation="0dp" . It should remove the shadow

 <android.support.design.widget.BottomNavigationView
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    app:menu="@menu/bottom_menu" 
    app:elevation="0dp"/>

Then take a 9 patch image with your color shadow and set it as background

Manohar
  • 19,149
  • 8
  • 90
  • 129
0

Use the code Create shadow.xml in drawable

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient android:startColor="#757575"
        android:endColor="@android:color/transparent"
        android:angle="90"/>


</shape>

Call this in layout xml

 <View
            android:background="@drawable/dgb"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_8sdp"/>
Athira
  • 1,144
  • 2
  • 12
  • 35