I want to combine 2 Drawables into one, as can be seen from my layout:
http://i.imgur.com/tOEiO.jpg
I want to use drawable as the background of a TextView object. I tried like this:
Drawable[] layers = new Drawable[2];
layers[0] = new ColorDrawable(0xffff0000);
layers[1] = resources.getDrawable(android.R.drawable.ic_btn_speak_now);
LayerDrawable layerDrawable = new LayerDrawable(layers);
setBackgroundDrawable(layerDrawable);
Unfortunately, with this code, Drawable from layer 1 scales to the size of the TextView object.
Now my question is:
How can I get Dalvik to position layer 1 always vertically centered and horizontally right, and not scale it to the size of another layer? (e.g. in my layout).
Many thanks!
pmeng source
share