更新时间:2023-01-05 14:55:46
在您的布局 xml 中执行以下操作:
In your layout xml do the following:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/holo_red_dark" />
<corners android:radius="32dp" />
</shape>
通过改变 android:radius
你可以改变角的半径"数量.
By changing the android:radius
you can change the amount of "radius" of the corners.
<solid>
用于定义drawable的颜色.
<solid>
is used to define the color of the drawable.
您可以使用 android:bottomLeftRadius
、android:bottomRightRadius
、android:topLeftRadius
替换 android:radius
和 android:topRightRadius
来定义每个角的半径.
You can use replace android:radius
with android:bottomLeftRadius
, android:bottomRightRadius
, android:topLeftRadius
and android:topRightRadius
to define radius for each corner.