Hi All,
I have the following code. I only got a black screen without seeing
the white image.
public class Demo extends Activity {
private MyCtrl mCtrl;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCtrl = new MyCtrl(this);
setContentView(mCtrl);
}
}
public class MyCtrl extends ScrollView {
public MyCtrl (Context context) {
super(context);
setFocusable(true);
int width = 100;
int height = 100;
int size = width * height;
int buf[] = new int[size];
for ( int i = 0; i < size; ++i) {
buf[i] = 0xFFFFFFFF; //white image
}
Bitmap bmp = Bitmap.createBitmap(buf, width, height,
Bitmap.Config.ARGB_4444);
ImageView iv = new ImageView(getContext());
iv.setLayoutParams( new LinearLayout.LayoutParams(width, height) );
iv.setImageBitmap(bmp);
iv.setScaleType(ImageView.ScaleType.CENTER);
addView(iv);
}
}
However, if I derive MyCtrl from ImageView directly, the white image
shows up.
Your help is highly appreciated.
Cheers,
Frank
--
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