how to display complete Bitmap in android using Canvas?
friends,
i am using following onDraw method to display bitmap on screen.
@Override
public void onDraw(Canvas canvas) {
Bitmap _scratch = BitmapFactory.decodeResource(getResources(), R.drawable.icon2);
//ImageView img= new ImageView(Tutorial2D.this);
//img.setImageBitmap(_scratch);
canvas.drawColor(Color开发者_Go百科.BLACK);
canvas.drawBitmap(_scratch, 0, 0, null);
}
image is displayed on the screen but some part because android screen is small how can i display complete image in whole android screen?
can i set ScaleType of image to fitxy in canvas ?
or
can i add android layout image to this canvas so that i could set fitxy property or image there as i have commented the code?
any help would be appreciated.
You can call Bitmap.createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter)
You can use a ImageView
iv = (ImageView) findViewById(R.id.ImageView01);
iv.setImageBitmap(getImageBitmap(myurl));
精彩评论