android - How to add icon hint Edittext in center -


how add icon hint edittext in center

i have no idea set

and in xml file not have android:drawblecenter

how create it

thanks ;)

enter image description here

unfortunately can not set drawable @ center of edittext this, alternatively, can use background image includes hint + image ever display , inside,

try below example.

<relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="15dp" android:layout_marginright="15dp" android:background="@android:drawable/editbox_background" android:gravity="center">  <edittext     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:background="@null"     android:drawableleft="@android:drawable/ic_menu_search"     android:gravity="center"     android:hint="search" /> </relativelayout>  

you can achieve type of view using above xml code

enter image description here


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -