【发布时间】:2020-08-27 12:30:36
【问题描述】:
我试图给我的按钮一个渐变背景和更强的笔触。我已经阅读/看过很多教程,但对我没有任何帮助。
这是我的插件 .xml 文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:shape="rectangle">
<gradient android:startColor="#25AAFF"
android:endColor="#004F81">
</gradient>
<stroke
android:width="5dp"
android:color="#000000">
</stroke>
<corners android:radius="5dp"></corners>
注意:角落工作正常
和按钮文件
<Button
android:background="@drawable/login_button"
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/login_password_input"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/login_button_text"
android:textColor="#FFFFFF"
android:textStyle="bold">
</Button>
【问题讨论】:
-
你在使用材料组件库吗?
标签: java android android-button material-components-android material-components