Just for kicks, have you tried loading the image from XML just to see if it
displays differently?  If it displays differently (meaning correctly) then
there is probably some setting that gets set by default in XML that is not
getting set in code.

Another option...

If the number of stars is always out of the same number (as you mention, out
of 10) then you could define 10 image views in XML and do one of the
following based on the value read from the database:

   - Hide the stars so that you only see the correct rating value
   - Always display all 10 images but have two images for the stars...
   Default them to a greyed out or disabled image, and replace the appropriate
   images with another image such as a yellow star.  This seems to be a
   standard way of displaying ratings as stars and I would recommend this
   way...



Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Tue, Oct 18, 2011 at 4:51 PM, occorled <occor...@gmail.com> wrote:

> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to