Android 如何在布局边框xml文件中添加渐变效果
这是我的xml文件,它在线性布局周围添加边框。如何在该代码中添加渐变色效果代码?我想用渐变色替换这个颜色 下面是我的代码Android 如何在布局边框xml文件中添加渐变效果,android,Android,这是我的xml文件,它在线性布局周围添加边框。如何在该代码中添加渐变色效果代码?我想用渐变色替换这个颜色 下面是我的代码 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle">
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<item
android:left="1dp"
android:right="1dp"
android:top="2dp"
android:bottom="2dp" >
<shape android:shape="rectangle">
<solid android:color="#C0C0C0" />
</shape>
</item>
</layer-list>
我想在我的border.xml文件中添加这段代码我如何合并
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#fefdfe"
android:endColor="#e8e3ec"
android:angle="90" />
</shape>
只需更换
<shape android:shape="rectangle">
<solid android:color="#C0C0C0" />
</shape>
使用渐变形状。尝试以下方法:-
<shape android:shape="rectangle">
<gradient
android:startColor="#5a5a5a88"
android:endColor="#14141488"
android:angle="270" android:centerX="0.25"/>
</shape>
用渐变填充布局:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="#4fc939"
android:centerColor="#0c87c5"
android:endColor="#b4ec51"
android:angle="180" />
</shape>
</item>