所以,你把这些图片放到{*} dpi文件夹中吧? 正如您可能已经知道的那样,您将正常分辨率(最适合您的应用程序的分辨率 - 设备大小和分辨率)图像放入“mdpi”文件夹中。如果您的应用程序以超高分辨率在extraLarge设备中使用(xdpi),它会将图像放大到2.0倍,如果设备大而高分辨率(hdpi),它会将图像放大到1.5倍。如果设备具有较小的尺寸,则android会将图像尺寸缩小至0.75。 但是,如果它还不够(对我来说还不够),您可以简单地找出目标设备的分辨率并将图像调整为自己。 您只需要找出(必须为自己计算)常量来调整图像的分辨率。例如; 0.6(根据发现的屏幕分辨率,你会倍增图像的宽度&高度与不断 这是我的例子:
Display currentScreen = this.getWindowManager().getDefaultDisplay();
Point dimension = new Point();
currentScreen.getSize(dimension);
//int widthPixel = dimension.x;
int heightPixel = dimension.y;
System.out.println("Screen Resolution (Height) : "+heightPixel);
int imgHeight;
imgHeight = (int) Math.floor(heightPixel * 0.6);
int widthSeparator = (int) dimension.y/13;
System.out.println("Width Separator : "+widthSeparator);
//imgHeight = 240;
System.out.println("Image Resolution (Height) : "+imgHeight);
FrameLayout.LayoutParams layoutParamCR = new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParamCR.setMargins(widthSeparator, 0, 0, 0);
//FrameLayout.LayoutParams layoutParamL = new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
//layoutParamL.setMargins(-30, 0, 0, 0);
ImageView leftCover = (ImageView) findViewById(R.id.magCoverLeft);
leftCover.setAdjustViewBounds(true);
leftCover.setMaxHeight(imgHeight);
leftCover.setLayoutParams(layoutParamCR);
leftCover.setImageBitmap(null);
ImageView cover = (ImageView) findViewById(R.id.magCover);
cover.setAdjustViewBounds(true);
cover.setMaxHeight(imgHeight);
cover.setLayoutParams(layoutParamCR);
cover.setImageBitmap(coverImages[0]);
ImageView rightCover = (ImageView) findViewById(R.id.magCoverRight);
rightCover.setAdjustViewBounds(true);
rightCover.setMaxHeight(imgHeight);
rightCover.setLayoutParams(layoutParamCR);
rightCover.setImageBitmap(coverImages[1]);
感谢亲爱昂,图像不存储在设备和所有的他们来自互联网和图像视图根据图像数量动态生成。但是,我得到了你的想法。谢谢。让我测试它看看不同的屏幕尺寸的结果是什么... – Hesam
不客气..我以为你的图像位于{*} dpi文件夹中。 我的例子更适合来自Internet的图像,因为我是这样写的。 –