Android developers, I need to put an image at the beginning of the input:
How can I do this?
Android developers, I need to put an image at the beginning of the input:
How can I do this?
To add an image to the left corner of edittext, you can add the android:drawableLeft
property to your XML.
Example:
<EditText
android:id="@+id/editSenha"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
<!-- AQUI É ONDE DEFINO O ICONE -->
android:drawableLeft="@drawable/icon_lock"
android:inputType="textWebPassword"/>
If you want to add on the right side, android:drawableRight
.
What I did to solve this issue did not involve 1 line of code I just edited an image with the drawing on the side I wanted with the necessary resolutions for the android API.