按钮的形状 (AndroidStudio)

问题描述 投票:0回答:1

尝试做一件简单的事情,为按钮应用形状。但!从我的简单形状 xml 来看,只有角标记有效,但笔划标记不适用于我的按钮。

button_shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke android:width="5dip" android:color="#FFFFFF" />
    <corners android:radius="10dp" />

</shape>

按钮.xml

<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/genres_or_languages_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Something"
    android:background="@drawable/button_shape">
</Button>

一切都应该如此简单,我什至不知道会出现什么问题......

xml kotlin android-studio button shapes
1个回答
0
投票
  1. 在任何布局(如约束布局)中找到按钮
  2. 使用backgroundTint代替背景。
  3. 更改button_shape.xml的颜色
© www.soinside.com 2019 - 2024. All rights reserved.