如何绘制Android的UI圆角矩形? [英] How to draw rounded rectangle in Android UI?
本文介绍了如何绘制Android的UI圆角矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要绘制一个圆角矩形,在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.
这篇关于如何绘制Android的UI圆角矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文