简体   繁体   English

Android图片无法正确缩放

[英]Android images not scaling properly

I still can't understand how images are scaled. 我仍然不明白如何缩放图像。 I have this 600px x 600px image. 我有这个600px x 600px的图像。 I scaled it to different sizes (ie. to 450 x 450, 300x300 and 225x225). 我将其缩放为不同的尺寸(即450 x 450、300x300和225x225)。 I did that in order for devices with different screen densities adjust the size of the image. 我这样做是为了让具有不同屏幕密度的设备调整图像的大小。 Then I placed an imageview to a generic 1280x800 10.1" tablet, which is mdpi as stated by the ADT. It views properly on the 10.1 tablet graphical layout but seems oversized on the other devices especially on the phone category. Here is the link to image: 然后,我将图像视图放置到通用1280x800 10.1“平板电脑上,按照ADT的规定,其分辨率为mdpi。它在10.1平板电脑的图形布局上可以正常显示,但在其他设备上尤其是在手机类别上似乎过大。这是图像的链接:

在此处输入图片说明

The layout width and height are also set to wrap_content, should I set it to a value in dp? 布局的宽度和高度也都设置为wrap_content,我是否应该将其设置为dp中的值?

since, its an mdpi tablet, the resource is being picked from the drawable-mdpi folder and thus appearing that small. 因为它是mdpi平板电脑,所以从drawable-mdpi文件夹中选取了资源,因此显得很小。

Perhaps you can create a layout-mdpi-xlarge folder and then in that layout refer a copy of the image from the xhdpi folder. 也许您可以创建一个layout-mdpi-xlarge文件夹,然后在该布局中引用xhdpi文件夹中的图像副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM