Подтвердить что ты не робот

Изменить размер нижней границы EditText

У меня есть код EditText в моем коде, и я хочу сделать его нижнюю границу немного тоньше. Не мог найти ничего об этом в Интернете, может быть, кто-нибудь может помочь мне в этом.

Что у меня есть: enter image description here

Что я хочу: enter image description here

4b9b3361

Ответ 1

Попробуйте сделать это для эффектов фокуса:

edt_bg_selector.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/edt_bg_selected" android:state_focused="true"/>
<item android:drawable="@drawable/edt_bg_normal" android:state_focused="false"/>
</selector>

edt_bg_normal.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:bottom="1dp"
    android:left="-2dp"
    android:right="-2dp"
    android:top="-2dp">
    <shape android:shape="rectangle" >
        <stroke
            android:width="1px"
            android:color="#FF000000" />

        <solid android:color="#00FFFFFF" />

        <padding
            android:bottom="5dp"
            android:left="5dp"
            android:right="5dp"
            android:top="5dp" />
    </shape>
</item>
</layer-list>

edt_bg_selected.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:bottom="1dp"
    android:left="-2dp"
    android:right="-2dp"
    android:top="-2dp">
    <shape android:shape="rectangle" >
        <stroke
            android:width="1px"
            android:color="#ff0000" />

        <solid android:color="#00FFFFFF" />

        <padding
            android:bottom="5dp"
            android:left="5dp"
            android:right="5dp"
            android:top="5dp" />
    </shape>
</item>
</layer-list>

и измените текст редактирования следующим образом:

 <EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/edt_bg_selector" />

Ответ 2

Попробуйте следующее:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        android:hint="Biografie"
        android:textColorHint="#99000000"
        android:drawableLeft="@drawable/quote_img" />

    <View
        android:layout_width="match_parent"
        android:layout_height="1px"
        android:background="#80000000" />
</LinearLayout>

или

сохраните этот файл btm_line_shape.xml в вашей папке с выделением:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
    android:bottom="1dp"
    android:left="-2dp"
    android:right="-2dp"
    android:top="-2dp">
    <shape android:shape="rectangle" >
        <stroke
            android:width="1px"
            android:color="#FF000000" />

        <solid android:color="#00FFFFFF" />

        <padding
            android:bottom="5dp"
            android:left="5dp"
            android:right="5dp"
            android:top="5dp" />
    </shape>
</item>
</layer-list>

и

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Biografie"
    android:textColorHint="#99000000"
    android:background="@drawable/btm_line_shape"
    android:drawableLeft="@drawable/quote_image" />