-1

I have the following EditText .

          <EditText
            android:id="@+id/editText7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10" />

For this edittext I have got the following layout .

enter image description here

But I want to get the edittext like following :

enter image description here

How to get the edittext like above ?

Community
  • 1
  • 1
osimer pothe
  • 2,827
  • 14
  • 54
  • 92
  • you can create using XML. check out http://stackoverflow.com/questions/3646415/how-to-create-edittext-with-rounded-corners and http://stackoverflow.com/questions/10124919/can-i-draw-rectangle-in-xml – Keyur Lakhani May 10 '16 at 06:01
  • have look on my edit answer it solve your problem i checked it ...... – sushildlh May 10 '16 at 06:08

4 Answers4

1

Create a drawable background.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@android:color/very_light_grey"/>
    <stroke android:width="1dp" android:color="@color/grey"/>
</shape>

Change your edittext to

<EditText
  android:background="@drawable/background"
  android:layout_width="match_parent"
  android:paddingLeft="60dp"
  android:layout_height="wrap_content"/>
Ankit Aggarwal
  • 5,317
  • 2
  • 30
  • 53
0

you can set padding in edit Text.

android:padding="10dp"
Vasant
  • 3,475
  • 3
  • 19
  • 33
0

Its basically goes with android version of the device.Earlier version of android EditText has somewhat similar kind look as you looking for. But with latest you will get line. I would like suggest go change edit text theme or background to serve your purpose.

Sush
  • 3,864
  • 2
  • 17
  • 35
0

Set background of edittext in xml using

android:background="Your Color Code"
anonymous
  • 401
  • 7
  • 15