我在android按钮中有一个形状,我想要将其上色为两种颜色。但不是渐变。只是颜色,该怎么办?下面是我的绘画。我不希望它是渐变色,只是两种颜色。
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:angle="0"
android:endColor="#e574bd"
android:startColor="#874dbc"
android:type="linear" />
<corners
android:radius="20dp"/>
</shape>
<RelativeLayout
android:id="@+id/registration"
android:layout_width="match_parent"
android:layout_height="@dimen/buttonHeight"
android:paddingEnd="@dimen/default_margin"
android:paddingStart="@dimen/default_margin"
android:background="@drawable/abovexml"
android:gravity="center_horizontal">
<ImageView
android:layout_width="match_parent"
android:id="@+id/sadad2"
android:src="@+id/theimagewithoutwordingchangepassword"
android:scaleType="fitXY"
android:layout_height="@dimen/buttonHeight"/>
<TextView
android:id="@+id/loginText"
android:layout_width="match_parent"
android:layout_height="@dimen/buttonHeight"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/changepass"
android:textColor="@android:color/white"
android:textSize="@dimen/buttonSize"></TextView>
</RelativeLayout>