朋友们,
我正在使用以下代码来调整图片大小
private Bitmap resizeImage( final Bitmap image) {
Bitmap resizedImage = null;
if(image != null)
{
int maxHeight = 80; //actual image height coming from internet
int maxWidth = 150; //actual image width coming from internet
int imageHeight = image.getHeight();
if ( imageHeight > maxHeight )
imageHeight = maxHeight;
int imageWidth = (imageHeight*image.getWidth()) / image.getHeight();
if ( imageWidth > maxWidth ) {
imageWidth = maxWidth;
imageHeight = (imageWidth*image.getHeight()) / image.getWidth();
}
resizedImage = Bitmap.createScaledBitmap( image, imageWidth, imageHeight, true);
}
return resizedImage;
}
来自互联网。 现在它在高分辨率屏幕上运行良好,但在小屏幕上不行。有没有人能指导我如何根据屏幕分辨率显示图像?
Point size = new Point(); display.getSize(size); int screenWidth = size.x; int screenHeight = size.y;
- Ε Г И І И О