我的 android 应用程序中有两个 EditText 字段。我在一个带有 XMl 文件的 Edittext 字段中添加了圆角。像这样如何使用圆角制作第二个 EditText?谢谢你的帮助。
问问题
75 次
1 回答
3
只需创建一个可绘制资源,指定 EditText 的绘制方式:
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
在你的布局中引用这个drawable:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:background="@drawable/rounded_edittext" />
</LinearLayout>
于 2013-07-26T12:40:43.650 回答