us2956
us2956

Reputation: 516

How to change color of the line that top of the bottom navigation view

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?

Upvotes: 0

Views: 2055

Answers (3)

Athira
Athira

Reputation: 1213

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"/>

Upvotes: 0

Manohar
Manohar

Reputation: 23404

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

Upvotes: 0

DKV
DKV

Reputation: 1767

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

Upvotes: 1

Related Questions