Car*_*z M 3 android android-button material-design material-components-android materialbutton
这是我的材质按钮代码:
<com.google.android.material.button.MaterialButton
android:id="@+id/next_button"
android:layout_width="224dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="68dp"
android:layout_marginTop="510dp"
android:layout_marginEnd="68dp"
android:layout_marginBottom="68dp"
android:background="@color/colorPrimary"
android:minHeight="60dp"
android:text="@string/onboarding_next_button"
android:textColor="@android:color/white"
app:cornerRadius="25dp" />
Run Code Online (Sandbox Code Playgroud)
将材质库从 1.1.0 更新到 1.2.0 后,app:CornerRadius 将被忽略。我尝试使用形状主题遵循材质文档,但控件仍然完全方形
使用 app:backgroundTint而不是android:background
<com.google.android.material.button.MaterialButton
app:backgroundTint="@color/colorPrimary"
.../>
Run Code Online (Sandbox Code Playgroud)
首先1.2.0可以android:background在 中使用MaterialButton。使用自定义 android:background不使用默认值MaterialShapeDrawable,并且未设置某些功能,如笔触、形状外观、角半径、波纹(因为它们与 相关)MaterialShapeDrawable,您必须为它们提供自定义背景
由于您使用简单的颜色作为背景,因此只需使用app:backgroundTint.
| 归档时间: |
|
| 查看次数: |
1634 次 |
| 最近记录: |