如何在Android UI中绘制圆角矩形?

马穆拉里

我需要在Android用户界面中绘制一个圆角矩形。对于具有相同的圆角矩形TextViewEditText这也将有所帮助。

安德烈斯

在布局xml中执行以下操作:

<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您可以更改角的“半径”。

<solid> 用于定义可绘制对象的颜色。

您可以使用替换android:radiusandroid:bottomLeftRadiusandroid:bottomRightRadiusandroid:topLeftRadiusandroid:topRightRadius定义半径每个角落。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章