I am using the canvas to display an image in Android. I want an image
to occupy the center of the screen irrespective of the sizes of the
screen. So how could i achieve it.
This is the snippet that i tried with, Please let me know your ideas
too.
@Override
protected void onDraw(Canvas canvas) {
..........
..........
// This moves the image to right end of the view.
sampleImage.draw(canvas,getWidth(),getHeight());
// Tried with this code too, but not getting the image at
the center of the screen.
sampleImage.draw(canvas,getWidth()/2 - imageWidth/
2 ,getHeight()/2 - imageHeight/2);
..........
..........
Thank you
--
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