Tuesday, October 18, 2011

[android-developers] ImageView dynamically added to AlertDialog drawing incorrectly

I'm trying to draw some varying number of images on an AlertDialog.
Example (1 to 10 star images, based on some rating value I read from a
database). So this is something that I think should be done
dynamically, not from an XML file layout.

The image shows up weird (I wish I could attach a screenshot). I see
some of the image outline, but not the image itself. The image
resource is a gold star (.png) with alpha background.

Should I be using the function "setColorFilter()"? And if so, how/
why?

I think there is something basic about ImageView resources that I am
missing...

Here is my code:
AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle(title);
alert.setMessage(author);
{
ImageView i = new ImageView(this);
i.setImageResource(R.drawable.ic_star);
alert.setView(i);
}
alert.show();

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

No comments:

Post a Comment