Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Padding for hint text inside EditText

I want to be able to add padding to the text that is displayed inside the EditText, using

android:hint="some text"

If I only add padding for the EditText regularly, it adds the padding for the whole view. And i want it for the text that gives a hint for the user, what needs to be entered. If someone knows how to do this, please give me a feedback.

enter image description here

like image 702
Sandra Avatar asked Apr 17 '12 15:04

Sandra


1 Answers

You may find your solution in this answer: EditText set text start 10dp from left border

It helped me to achieve the padding for hint in username field:

<EditText
 android:id="@+id/txtUsername"
 android:layout_width="match_parent"
 android:layout_height="30dp"
 android:layout_alignParentLeft="true"
 android:background="@drawable/bkg_login_txt_usuario"
 android:hint="@string/hint_username"
 android:paddingLeft="10dp"
 android:singleLine="true" >
 <requestFocus />
</EditText>

I hope this helps.

like image 82
fanky10 Avatar answered Sep 26 '22 01:09

fanky10