Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何更改底部导航视图顶部的线条颜色_Android_Background Color_Bottomnavigationview - Fatal编程技术网

Android 如何更改底部导航视图顶部的线条颜色

Android 如何更改底部导航视图顶部的线条颜色,android,background-color,bottomnavigationview,Android,Background Color,Bottomnavigationview,我想为底部导航视图设置背景色为白色。但是有一个顶部阴影 我想换一下这个颜色。如何执行此操作?无法更改框架提供的立面阴影的颜色,但您可以使用库来执行此操作,请参阅 无法更改框架提供的立面阴影的颜色,但您可以使用库进行更改,请参阅 尝试设置app:elevation=“0dp”。它应该消除阴影 <android.support.design.widget.BottomNavigationView android:id="@+id/bottomBar" android:lay

我想为底部导航视图设置背景色为白色。但是有一个顶部阴影


我想换一下这个颜色。如何执行此操作?

无法更改框架提供的立面阴影的颜色,但您可以使用库来执行此操作,请参阅


无法更改框架提供的立面阴影的颜色,但您可以使用库进行更改,请参阅


尝试设置
app:elevation=“0dp”
。它应该消除阴影

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


然后拍摄一张带有彩色阴影的9面片图像,并将其设置为背景

尝试设置
app:elevation=“0dp”
。它应该消除阴影

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

然后拍摄一张带有彩色阴影的9面片图像,并将其设置为背景

使用代码 在drawable中创建shadow.xml

<?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>

在布局xml中调用此函数

 <View
            android:background="@drawable/dgb"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_8sdp"/>

使用代码 在drawable中创建shadow.xml

<?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>

在布局xml中调用此函数

 <View
            android:background="@drawable/dgb"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_8sdp"/>


我不想移除阴影。我想改变它的颜色。用你的彩色阴影拍摄一张9面片图像,并将其设置为背景。我不想移除阴影。我想改变它的颜色。用你的彩色阴影拍摄一张9面片图像,并将其设置为背景