I subclassed the ImageView class inorder to draw a Picture in an
ImageView. The ImageView is added to a Gallery
In my activity class:
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));

My Adapter class:
private class ImageAdapter extends BaseAdapter{
..
public View getView(int position, View convertView, ViewGroup parent)
{

        MyImageView m = new MyImageView(mContext); //where mContext my
main Activity
        return m;
                    }
}

In my custom ImageView class: I have the following in my OnDraw
method

protected void onDraw(Canvas canvas)
{
    super.OnDraw(canvas);
    canvas.drawColor(Color.BLUE);
}

There is no change - the area is still black.

If I use setImageResource and then have the following in OnDraw
(canvas)

protected void onDraw(Canvas canvas)
{
    super.OnDraw(canvas);
}

The image shows up correctly.

Any ideas on why my drawColor(Color.BLUE) is not taking effect in the
Gallery?



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

Reply via email to