FAFI
FAFI

Reputation: 379

Android EditText look

I wanna make the editText to look like this: desired

what else should I do after I set the editText's background how can I make the text start inside the edittext via code.

Upvotes: 1

Views: 560

Answers (3)

Adil Hussain
Adil Hussain

Reputation: 32093

As well as setting the background of the EditText view, set left and right padding, e.g.

<EditText 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/edittext_bg"
    android:paddingLeft="7dp"
    android:paddingRight="7dp" />

Upvotes: 0

cephus
cephus

Reputation: 2027

Are you trying to get the EditText to say "Username" by default, but not have that be the actual text?

For that you can use EditText.setHint() (inherited from TextView) or in the xml definition use android:hint, such as

<EditText 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="Username" />

Upvotes: 1

sandalone
sandalone

Reputation: 41749

To make text look like that, set the Gravity attribute to left. The gravity of EditText element.

Upvotes: 0

Related Questions