我需要绘制一个圆角矩形,在Android的UI。具有相同圆角矩形的TextView和EditText上也将是有益的。
I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView and EditText would also be helpful.
在你的布局XML执行以下操作:
In your layout xml do the following:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="@color/something"
android:centerColor="@color/something_else"
android:startColor="@color/something_else_still"
android:angle="270" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
通过改变机器人:半径可以改变四舍五入的角量
By changing the android:radius you can change the amount of "rounding" of the corners.