Adding images to an edit text view

46 Views Asked by At

How do I add an image to an edit view in Android Studio something similar to this:

enter image description here

Where an image view shows up in an edit text view

I've thought of nesting views but that's not an option in Android Studio or embedding a layout inside the edit view every time a picture gets added.

1

There are 1 best solutions below

0
Tech Bro On

EditText is not a view group but a view, unlike Linear Layout or any other layouts. You can make use of ConstraintLayout and constraint the Image to the EditText.

OR

You can add this line to the EditText

android:drawableStart="R.drawable.my_image"

OR

android:drawableEnd="R.drawable.my_image"