如何删除彩色的EditText焦点边框

时间:2016-06-02 04:08:30

标签: android android-layout android-edittext focus

我想移除EditText上的EditText焦点边框。我想要它,以便我的EditText看起来像这样:

here

话虽这么说,我已经在网上查看,以便删除EditText的底部焦点颜色,尝试将我的android:background="#00000000"设置为android:background="@android:drawable/editbox_background_normal"以及{{1} }。但是,hte首先隐藏整个下划线边框(我只想隐藏焦点下划线颜色,而不是下划线本身),后者使我的EditText成为一个大白框。有没有办法复制我想要的东西?谢谢!

2 个答案:

答案 0 :(得分:1)

试试这个

<强> edittext_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <!-- Draw a 1dp width border around shape -->
        <stroke
            android:color="#d3d3d3"
            android:width="1dp"
            />
    </shape>
</item>
<!-- Draw only bottom border using background color  -->
<item
    android:bottom="1dp"
    >
    <shape android:shape="rectangle">
        <solid android:color="#ffffff"/>
    </shape>
</item>
</layer-list>

并将背景应用于您的EditText

android:background="@drawable/edittext_bg"

答案 1 :(得分:0)

您也可以尝试这样,将其放在edittext

下面
 <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/black" />