android EditText 圆弧形
时间: 2024-01-08 18:02:24 浏览: 75
要将 Android EditText 控件设置为圆弧形,需要进行以下步骤:
1. 创建一个 drawable 资源文件,例如 `round_edittext.xml`,并设置 `shape` 为 `rectangle`,同时设置 `corners` 属性为半径大小,例如:
```xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:padding="10dp">
<corners
android:bottomRightRadius="20dp"
android:bottomLeftRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
```
2. 在布局文件中,将 EditText 的背景属性设置为刚刚创建的 drawable 资源文件,例如:
```xml
<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/round_edittext" />
```
这样就可以将 EditText 控件设置为圆弧形了。
阅读全文
相关推荐













