文本编辑框设置圆角

来源:互联网 发布:手机淘宝如何修改评论 编辑:程序博客网 时间:2024/04/29 12:40

第一步在drawable-mdpi(根据像素自选)下创建shape.xml文件

内容如下:

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"    android:shape="rectangle" >    <!-- 填充的颜色 -->    <solid android:color="#ffffff" />    <!-- 设置矩形的四个角为弧形 -->    <!-- android:radius弧形半径 -->    <corners android:radius="7dip" /></shape>


第二步

创建文本编辑框


 <EditText        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:background="@drawable/shape"        android:text="请输入" />


完成这俩个就完成了,注意:请设置背景色为其他颜色,才能看出来是否为圆角


原创粉丝点击