user3886688
user3886688

Reputation: 51

How can use Image In editText Android

username

password

How can i use above image inside of edit text Android?

Upvotes: 0

Views: 105

Answers (3)

Mohamed Fadl Allah
Mohamed Fadl Allah

Reputation: 189

Add left paddding and set EditText background to your drawable:

android:paddingLeft="10dp"
android:background="@drawable/my_icon"

Upvotes: 0

Moubeen Farooq Khan
Moubeen Farooq Khan

Reputation: 2885

user this in your edittext

<EditText
...     
android:drawableLeft="@drawable/my_icon" />

Another way is that you can create ImageView for that icon. This way you have more control on placing it

Upvotes: 1

yildirimyigit
yildirimyigit

Reputation: 3022

You can use the "drawableLeft" attribute of EditText. For example:

android:drawableLeft="@drawable/ic_user"

http://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableLeft

Upvotes: 1

Related Questions