文本编辑框设置圆角

第一步在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="请输入" />


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


版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/shipeng22022/p/4614060.html