Fork me on GitHub

EditText的圆角与边框

先看一下效果图:

先创建一个xml文件edittext_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" >
    </solid>
    <!-- 设置圆角 -->
    <corners
        android:radius="1dp"
        android:bottomLeftRadius="15dp"
        android:bottomRightRadius="15dp"
        android:topLeftRadius="15dp"
        android:topRightRadius="15dp" >
    </corners>
    <!-- 设置边框 -->
      <stroke android:width="1dip" android:color="#ff000000" />

</shape>

接着在需要设置圆角样式的edittext中设置background属性:

<EditText 
              android:id="@+id/et_empid"
              android:layout_width="match_parent"
              android:layout_height="50dp"
              android:text=""
              android:textSize="25sp"
              android:background="@drawable/edittext_shape"
              android:layout_toRightOf="@id/tv_empid"
              android:paddingLeft="10dp"
              android:textColor="#3b3c3c"
              android:hint="请输入员工编号"
              />

最后运行项目,就出现了上面的效果图。

posted on 2015-01-28 21:10  骑着乌龟漫步  阅读(1003)  评论(0编辑  收藏  举报

导航