UMAR-MOBITSOLUTIONS
UMAR-MOBITSOLUTIONS

Reputation: 77984

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

Upvotes: 1

Views: 4401

Answers (2)

JoaquinG
JoaquinG

Reputation: 2070

You can use a ImageView

iv = (ImageView) findViewById(R.id.ImageView01);
iv.setImageBitmap(getImageBitmap(myurl));

Upvotes: 3

Related Questions