You can add an image to your EditText through android:background="@drawable/img".
If you want to modify the style by using nine patch or else, but if you want to add a small image in the left of your EditText consider using android:drawableRight="@drawable/icon".
is what you're talking about, then you just need to either set the Drawable{Right | Left | Top | Bottom} property in the xml, or call the corresponding java command.
EditText text = (EditText)findViewById(R.id.text);
text.setCompoundDrawables(null, null, getResources().getDrawable(R.drawable.check_box), null);
You can add an image to your
EditText
throughandroid:background="@drawable/img"
.If you want to modify the style by using nine patch or else, but if you want to add a small image in the left of your
EditText
consider usingandroid:drawableRight="@drawable/icon"
.If something like this:
is what you're talking about, then you just need to either set the
Drawable{Right | Left | Top | Bottom}
property in the xml, or call the corresponding java command.You can try this if you are in adapter class
and You can try this if you are in activity class
You can use setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom).