为什么不是一些xhdpi手机显示图像位于/ RES /只绘制?图像、不是、手机、RES

2023-09-05 02:38:27 作者:我不容众°

这是一个场景。有文件夹:

This is a scenario. There are folders:

绘制 绘制-LDPI 绘制-MDPI 绘制 - 华电国际 draawble-xhdpi

这是图像(通常为背景,但不一定要只这样的图像)位于 / RES /绘制只。

An image (usually background, but not bound to such images only) is located in /res/drawable only.

我测试上的Galaxy S3的应用程序和背景正确显示。我测试的HTC One X的,不显示背景图片。

I test the app on Galaxy S3 and the background is displayed properly. I test on HTC One X and background image is not being displayed.

如果我从 / RES /绘制的图像复制到 / RES /绘制-xhdpi 中,One X的将显示图像。

If I copy the image from /res/drawable to /res/drawable-xhdpi, the One X will display image.

思维逻辑,这个不应该发生,对不对?如果在绘制-xhdpi 无图像,然后机器人应该看看它到其他文件夹,直到它达到默认的 / RES /绘制,它应该从那里拉。

Thinking logically, this should not be happening, right?! If there is no image in drawable-xhdpi, then Android should look it into other folders until it reaches the default one /res/drawable and it should pull it from there.

这是为什么不会发生在一些手机?

Why is this not happening on some mobiles?

PS。我有一些药片发现同样的问题,但我现在不能哪些记忆。

PS. I noticed the same issue with some tablets, but I cannot remember now which ones.

PPS。我这里所说的背景图片,但问题是没有绑定到它。这也恰好与其他图像。据我所知,xhdpi手机有较大的图像问题,我不希望你认为这个问题是有太多的大背景图像。它也发生与正常尺寸的其他图像。

PPS. I mentioned background image here, but the issue is not bound to it. It also happens with other images. I am aware that xhdpi mobiles have issues with large images and I would not like you to think that the issue was with too large background image. It also happens with other images of "normal" size.

推荐答案

为什么你想要把图像文件放入文件夹绘制?

why do you want to put an image file into the drawable folder ?

根据提示我读过在互联网上,你不应该把图像文件,在绘制文件夹。

according to tips i've read over the internet , you should not put images files in the drawable folder .

在绘制文件夹,你只把XML类型的可绘制。

in the drawable folder you put only xml type drawables.

如果你想要把图像文件,把它放在任何下列文件夹(或添加其他预选赛对他们来说,或使用其它限定词):

if you want to put an image file , put it in any of the following folders (or add an additional qualifier for them , or use other qualifiers ) :

绘制-nodpi(仅适用于图像,你不知道什么应该是它们的大小) 绘制-LDPI 绘制-MDPI 绘制 - 华电国际 绘制-xhdpi 绘制-tvdpi

被放入绘制文件夹中的图片被视为默认,这是MDPI。所以,如果你想保持在同一屏幕密度类的文件,把它放入绘制-MDPI文件夹。

images that are put into the drawable folder are treated as default , which is mdpi . so if you want to keep the file in the same screen density category , put it into the drawable-mdpi folder.

另一个原因,不把图像到可绘制文件夹是Android将文件自动转换为16位图像对于某些设备(如三星Galaxy S),这将使图像看起来可怕在某些情况下。

another reason for not putting an image into the drawable folder is that android will automatically convert the file to 16 bit image for some devices (like the samsung galaxy s) , which will make the image look awful on some cases.

下面的解释这个问题的一个环节。

here's a link that explains this issue .

 
精彩推荐
图片推荐