I'm trying to create an EditText that has the following background images (aligned right) when a user inputs valid/invalid text:


How can I achieve this in Android? I've tried setting the background image using:
editText.setBackgroundResource(R.id.icon_tick), but when I do this, the whole image gets stretched to fit the EditText.