Input image

Asked

Viewed 276 times

3

Android developers, need to put an image at the beginning of input:

How can I do?

inserir a descrição da imagem aqui

  • 1

    Try setting an HTML code from EditText using the method Html.fromHtml() using the tag <img>, also use a ImageGetter to solve the image path. Also you need to ensure that the image will not be deleted (maybe it is worth using the hint of EditText). I could not test, if I still have time I test and put a response.

  • OK, I’ll test and await your return

  • 3

    @Wakim got, android:drawableLeft this is the code, end of topic

  • 1

    @Furlan, could you put the code as an answer? And then close the question?

2 answers

1

To add an image in the left corner of edittext, you can add the property android:drawableLeft in 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.

0

What I did to resolve this issue did not involve 1 line of code just edited an image with the drawing on the side I wanted with the resolutions required for the android API.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.