【发布时间】:2020-06-21 13:59:26
【问题描述】:
我尝试将可绘制对象设置为按钮的背景,但现在只有边角是圆角的。
这里是drawable的代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1000dp"/>
<solid android:color="@color/light_notlight_themebased_accentColor" />
<padding
android:bottom="7dp"
android:top="7dp"
android:left="7dp"
android:right="7dp" />
<stroke
android:color="@color/ContrastAndText"
android:width="10dp" />
</shape>
这里是按钮的代码:
<Button
android:id="@+id/loginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:background="@drawable/login_loginbutton_default"
android:text="@string/login_loginButton"
android:textAllCaps="true"
android:textColor="@color/NavbarAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />
笔画和颜色不显示(它保持背景色),只有角是圆角...
这是它的样子:
在 AndroidStudio 预览版(Canary 4.1)中:
设备上的最终结果:
我的错是什么?提前致谢!
【问题讨论】:
-
你在使用 Material Components 库吗?是哪个版本的?
-
是的,我是。 实现'com.google.android.material:material:1.1.0'
标签: android android-layout android-drawable android-button material-components-android