how to display complete Bitmap in android using Canvas?

Posted by UMMA on Stack Overflow See other posts from Stack Overflow or by UMMA
Published on 2010-06-10T09:47:28Z Indexed on 2010/06/10 10:12 UTC
Read the original article Hit count: 206

Filed under:

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

© Stack Overflow or respective owner

Related posts about android