Use canvas today. when the drawBitmap method draws an image, it finds a problem. When it is made in version 2.1, It is center-centered. When it is used in version 2.2, it finds the same image, but it cannot be centered. After reading the code, I used the same image and thought about it. It is estimated that it has something to do with the version. So I tested it and found the same test code, in version 2.1, the screen length and width are 533*320, and the width is 480*320. In version 2.2, the screen length and width are 800*480. I suddenly realized this result, because in my code, the width and height of the screen are unified to 480*320, the coordinates of an image are determined by the width and height of the screen and the image. The code is roughly as follows: Paint paint = new Paint (); // brush int screenWidth = 480; // screen width int screenHeight = 320; // screen height Bitmap bm = BitmapFactory. decodeResource (activity. getResources (), R. drawable. bnkjs); // picture currentX = screenWidth/2-bm.getWidth ()/2; // picture X coordinate currentY = screenHeight/2-bm.getHeight ()/2; // picture Y coordinate canvas. drawBitmap (bm, currentX, currentY, paint); then, the screen width and height are changed to get the width and height of the current screen, and then the screen can be normally centered. The Code is as follows: paint paint = new Paint (); // Paint int screenWidth = wm. getdefadisplay display (). getWidth (); // screen width int screenHeight = wm. getdefadisplay display (). getHeight (); // screen height Bitmap bm = BitmapFactory. decodeResource (activity. getResources (), R. drawable. bnkjs); // picture currentX = screenWidth/2-bm.getWidth ()/2; // picture X coordinate currentY = screenHeight/2-bm.getHeight ()/2; // picture Y coordinate canvas. drawBitmap (bm, currentX, currentY, paint );