when I set the background of my editText with “setBackgroundResource”, everything works fine. When I use “setBackgroundDrawable” with the same image it ends up stretched …
The result with “setBackgroundResource” on the left, “setBackgroundDrawable” on the right :
https://i.stack.imgur.com/yQi5n.jpg
(sorry I’m not allowed to post images here …)
The code :
View chips = EditChipsActivity.this.findViewById(mydID);
chips.setBackgroundResource(R.drawable.chips_filter);
VS :
View chips = EditChipsActivity.this.findViewById(mydID);
Bitmap bkg = ((BitmapDrawable) getResources().getDrawable(R.drawable.chips_filter)).getBitmap();
BitmapDrawable bkg = new BitmapDrawable(bkg);
chips.setBackgroundDrawable(bkg);
(I have to create my own bitmap and use the setBackgroundDrawable because I want to draw on the background)
Try this:
And your EditText:
I’m not if this do what you want….