android - 为按钮着色的渐变替代方案
问题描述
我在 android 按钮中有一个形状,我希望它有两种颜色。但不是渐变。只是颜色,怎么做?下面是我的drawable。我不想要它渐变,只是两种颜色。
<?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>
解决方案
推荐阅读
- java - 使用连字符打印连续日期
- javascript - 如何在 JavaScript 中重新启动 forEach() 循环
- android - Android 资源链接失败 datetimepicker attrs 未找到
- c# - 在 Unity 中沿光线投射实例化预定义数量的对象
- swift - 如何正确地将按键发送到 BG 应用程序,而 swift 脚本和编译的 swiftc 二进制文件之间没有区别
- sql - 如何计算非连续行之间经过的时间?
- android - 如何在 Firebase 应用中实现单设备登录?
- encoding - 将 int 列表解码为 utf8 时出现问题
- sql - SQL 数据透视表问题列值分成多列
- c - 如何配置 Codelite 以根据 C18 标准编译 C 程序