Hi,

I have some ImageViews that download images from the net. While
they're loading, I'd like to show an empty frame image. I'm doing
this, which looks fine:


public class MyFrame extends Shape
{
  private int mColorFrame;
  private int mColorInner;

  public DrawablePhotoLoading(int colorFrame, int colorInner) {
    super();
    mColorFrame = colorFrame;
    mColorInner = colorInner;
  }

  @Override
  public void draw(Canvas canvas, Paint paint) {
    paint.setColor(mColorInner);
    paint.setStyle(Style.FILL);
    canvas.drawRect(0, 0, getWidth(), getHeight(), paint);

    paint.setColor(mColorFrame);
    paint.setStyle(Style.STROKE);
    canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
}

then I use it like this:

  MyFrame mf = new MyFrame(0xFFCCCCCC, 0xFFFFFF);
  mf.resize(100, 100);
  myImageView.setBackgroundDrawable(new ShapeDrawable(mf);

if that all looks alright, can I create one global MyFrame instance
and let all ImageViews share it? I don't need to create an instance
for every ImageView, so long as I don't modify the original, right?

Thanks

-- 
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