问题
How can I make a gradient like this in xml

I can not do it with just these params
startColor=""
centerColor=""
endColor=""
any ideas ?
回答1:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:angle="90"
android:centerColor="#555994"
android:endColor="#b5b6d2"
android:startColor="#555994"
android:type="linear" />
<corners
android:radius="0dp"/>
</shape>
回答2:
if you want to draw it through shape you have to do work with layer-list
. You can think about it like two rectangles and every rectangle has its own gradient color.
来源:https://stackoverflow.com/questions/21284812/android-gradient-with-4-params