EditText 加边框

以前老版本有边框,现在倒没了,一开始以为是主题的问题,搜了一下搞个背景就行了

drawable目录新建文件 et_style.xml

 

<?xml version="1.0" encoding="utf-8" ?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:thickness="0dp"
       android:shape="rectangle">
    <stroke android:width="3dp"
            android:color="#4799E8"/>
    <corners android:radius="5dp" />
    <gradient
        android:startColor="#C8C8C8"
        android:endColor="#FFFFFF"
        android:type="linear"
        android:angle="270"/>
</shape>
View Code

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle" android:padding="10dp">
    <solid android:color="#FFFFFF"/>
    <stroke
        android:width="1dp"
        android:color="@android:color/black" />
    <corners
        android:bottomRightRadius="15dp"
        android:bottomLeftRadius="15dp"
        android:topLeftRadius="15dp"
        android:topRightRadius="15dp"/>
</shape>
View Code

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#ffffff" />
    <stroke android:width="1dip" android:color="#ff9900" />
</shape>
View Code

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners
        android:radius="2dp"
        />
    <solid android:color="#ffffff"
        />
    <stroke
        android:width="2dip"
        android:color="#000" />
</shape>
View Code

 

    <EditText
        android:padding="10dp"
        android:id="@+id/et_contact"
        android:hint="联系方式"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/et_style"
        />

 

    <EditText
        android:layout_marginTop="10dp"
        android:padding="10dp"
        android:id="@+id/et_content"
        android:hint="反馈内容"
        android:layout_below="@+id/et_contact"
        android:layout_above="@+id/hl_photo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        android:scrollbars="vertical"
        android:background="@drawable/et_style"
        />

 

 

posted @ 2016-11-03 19:39  demon9  阅读(406)  评论(0编辑  收藏  举报