Custom editText on android

I am new to Android layout, so I need help.

I want to create a custom editText, something like this:

An email field with this blue "bar" in the left side

I want to fix it in the best possible way.

Who!

Thank.

+1
source share
2 answers

If you need the blue line on the left, you can just set the background to EditText, for example,

    <EditText
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:background="@drawable/custom_edittext"
        android:layout_weight="1" />

Then create another file in your folder with the extension, this is called custom_layer.xml

   <?xml version="1.0" encoding="utf-8"?>
   <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:bottom="-5dp"
        android:right="-5dp"
        android:top="-5dp">
        <shape android:shape="rectangle" >
            <solid android:color="@color/color_of_the_background" />
            <stroke
                android:width="5dp"
                android:color="@color/color_of_the_border" />
        </shape>
    </item>
</layer-list>

And the final file selector is custom_edittext.xm.

<selector
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/custom_layer">        
    </item>
</selector>
+2
source

U Shape drawable EditText

+1

All Articles