Manjeet Brar Manjeet Brar - 1 month ago 11
Android Question

how add a border only on bottom of EditText?

I saw many related discussions but didn't find a suitable solution. What I need to do is to create a black border on the bottom side of an EditText widget. Is that possible?

Answer

I compiled this at my end :

<?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:state_pressed="true"><layer-list>
                <item android:bottom="-10dp" android:left="-10dp" android:right="-10dp"><shape>
                        <gradient android:angle="270" android:endColor="#a0e0b071" android:startColor="#a0a67637" />

                        <stroke android:width="10dp" android:color="#5c3708" />

                        <corners android:radius="5dp" />

                        <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
                    </shape></item>
            </layer-list></item>
        <item android:state_enabled="true"><layer-list>
                <item android:bottom="-10dp" android:left="-10dp" android:right="-10dp"><shape android:shape="rectangle">
                        <gradient android:angle="270" android:endColor="#a0a67637" android:startColor="#a0e0b071" />

                        <stroke android:width="10dp" android:color="#5c3708" />

                        <corners android:radius="5dp" />

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

    </selector>