[英]is it important to name drawable-hdpi for image in hdpi resolution?
I did some google search and look at documentation but i didn't find my answer. 我做了一些谷歌搜索,并查看文档,但没有找到答案。 Suppose i have an image and two version of it.
假设我有一个图像和它的两个版本。 One for hdpi devices and the other for ldpi devices .
一个用于hdpi设备,另一个用于ldpi设备。 Is it important to have two folder with exact name drawable-hdpi and drawable-ldpi ?
具有两个名称分别为drawable-hdpi和drawable-ldpi的文件夹是否重要? If yes is this the pattern to use drawable-amountofpixel ?
如果是,这是使用drawable-amountofpixel的模式吗? If no how android knows which folder to use when app is running on a hdpi device ?
如果没有,android如何在hdpi设备上运行应用程序时知道要使用哪个文件夹?
If App is running on hdpi phone, it will look for the assets and on a same time it will give preference to those icons which are present on drawable-hdpi
or drawable-ldpi
depending on the screen resolution of phone. 如果App在hdpi手机上运行,它将查找资产,同时,它会根据电话的屏幕分辨率优先显示在
drawable-hdpi
或drawable-ldpi
上的图标。
For example let us suppose you have image in drawable-ldpi
folder, open your App in hdpi or xhdpi phone. 例如,假设我们在
drawable-ldpi
文件夹中有图像,请在hdpi或xhdpi手机中打开您的应用程序。 You will find that icon is looking small on those screens but on a same way if you will show drawable-hdpi
icon in ldpi phone you will observe that icon is looking large. 在这些屏幕上,您会发现该图标看起来很小,但是如果您在ldpi电话中显示
drawable-hdpi
图标,您会以同样的方式观察到该图标看起来很大。
Check this answer to understand more about pixels and how they work on muti screens. 检查此答案以了解有关像素以及它们在多屏幕上如何工作的更多信息。
https://stackoverflow.com/a/45244453/1380032 https://stackoverflow.com/a/45244453/1380032
Is it important to have two folder with exact name drawable-hdpi and drawable-ldpi ?
具有两个名称分别为drawable-hdpi和drawable-ldpi的文件夹是否重要?
Yes. 是。 More accurately, it is important to have two directories that start with
drawable
and contain -hdpi
and -ldpi
as appropriate. 更准确地说,拥有两个以
drawable
开头并包含-hdpi
和-ldpi
目录非常重要。 It is possible to have more complex scenarios (eg, drawable-sw800-hdpi
). 可能会有更复杂的情况(例如
drawable-sw800-hdpi
)。
If yes is this the pattern to use drawable-amountofpixel ?
如果是,这是使用drawable-amountofpixel的模式吗?
The pattern is to use the density qualifiers that are covered in the documentation. 模式是使用文档中介绍的密度限定符。 See:
看到:
The "screen density (pixel)" row in the roster of resource set qualifiers 资源集预选赛名册中的“屏幕密度(像素)”行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.