Hello, I've a TextView that in the onCreate is build with an image to
the left from the static drawables, and with a text in the right.

I want to dynamically change the text and the image, (and maintain the
same image size), I have the image stored in a Bitmap named bm, (yes I
know I could change to a ImageButton and a textview but it has better
layout and I want to know if it's possible what I try to do, the way I
try)

I've tried different thing like:
Option 1:
TextView tv=(TextView)this.findViewById(R.id.TextView01);
BitmapDrawable bmd=new BitmapDrawable(bm);
tv.setCompoundDrawables(bmd.getCurrent(), null, null, null);
With this option the text remains inteact but NO image is draw...

Option 2:
the same but the end line is
tv.setBackgroundDrawable(bmd.getCurrent());
The Textview resizes to the image size and the image is draw and the
text is hidden by the image, not the desired behaviour... :-P

Option 3:
trying with canvas like:
Canvas can = new Canvas(bm);
Drawable d=tv.getBackground();
d.draw(can);
I got an exception so this is far from the solution...


Please any ideas of how can I achieve this?


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to