无论屏幕尺寸如何,Drawable 始终从 mdpi 文件夹中读取
我正在尝试创建一个适用于 Samsung Galaxy Tab GT P1000 和 Samsung Galaxy Tab 10.1 的应用程序;三星 Galaxy Tab 10.1 (1280 * 800) 的屏幕比 GT P1000 大得多,因此我假设 GT P1000 应该从 hdpi 读取,而 10.1 应该从 xhdpi 读取。令人惊讶的是,它们都从 mdpi 文件夹中读取。问候
I am trying to create an application that works both on Samsung galaxy tab GT P1000 and samsung galaxy tab 10.1; The samsung galaxy tab 10.1 (1280 * 800) has a much bigger screen than that of the GT P1000, so I am assuming the GT P1000 should read from hdpi, and 10.1 should read from xhdpi. The surprise is that both of them are reading from the mdpi folder. Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
大屏幕尺寸并不一定意味着高像素密度。对于像素密度,您必须考虑物理屏幕尺寸和屏幕分辨率。
例如,考虑
Galaxy Note 1
和Galaxy Tab 10.1
,两者的屏幕分辨率均为1280*800
,但 Galaxy Tab 10.1 的物理屏幕尺寸为 < code>10.1 英寸,而 Galaxy Note 的物理屏幕尺寸为5.3 英寸
,几乎是 Galaxy Tab 尺寸的一半。因此,Galaxy Note 的每英寸像素数比 Galaxy Tab 10.1 更多,并且具有xhdpi
密度,而 Galaxy Tab 10.1 具有mdpi
密度,请检查此链接中的密度值 -http://developer.android.com/guide/practices/screens_support.html
对于10.1 选项卡您应该使用
drawable-xlarge-mdpi
文件夹,GT P1000 也应该使用 mdpi,但正如我在许多在线帖子中看到的那样,GT P1000 有问题,它具有 mdpi 密度,但它使用 hdpi 中的可绘制对象,我自己没有检查过,所以对于 GT P1000 你可以尝试使用drawable-large-hdpi
文件夹,如果drawable-large-mdpi
不起作用。并在清单中添加 xlarge 支持。
你必须使用2.3及以上的sdk才能使用xlarge,因为它是后来添加的。
Large screen size does not necessarily means high pixel density. For pixel density you have to consider both physical screen size and screen resolution.
For example consider
Galaxy Note 1
andGalaxy Tab 10.1
, both have screen resolution of1280*800
but galaxy tab 10.1 has physical screen size of10.1 inch
whereas galaxy note has physical screen size of5.3 inch
, which is almost half of galaxy tab size. Thus galaxy note has more pixel per inch than galaxy tab 10.1 and it hasxhdpi
density, where as galaxy tab 10.1 hasmdpi
density, check density values in this link-http://developer.android.com/guide/practices/screens_support.html
For 10.1 tab you should use
drawable-xlarge-mdpi
folder and GT P1000 should also use mdpi but as I have seen on many online posts that GT P1000 has problem, it has mdpi density but it uses drawables from hdpi, I have not checked myself so for GT P1000 you can try to usedrawable-large-hdpi
folder, ifdrawable-large-mdpi
does not wok.And also add xlarge support in your manifest.
You have to use 2.3 and above sdk for using xlarge as it was added later.
mdpi
指的是屏幕密度(以每英寸点数为单位),而不是整体尺寸。我认为这两种设备具有相似的密度,因此它们从mdpi
文件夹加载资源。您可以根据实际屏幕尺寸(大/中/小)而不是密度来拥有单独的布局资源。请参阅文档。
mdpi
refers to the screen density, in dots per inch, not the overall size. I presume that both devices have similar densities, so they load resources from themdpi
folder.You can have separate layout resources based on the actual screen size (large/medium/small) rather than the density. Refer to the documentation.
只需创建新文件夹名称drawable-xlarge-mdpi并将所有图像粘贴到其中..设备将自动从该文件夹获取..!
我的 Galaxy Tab2 问题已解决!
Just Make new folder name drawable-xlarge-mdpi and paste all images in it.. Device will automatically get from that folder..!
My problem with Galaxy Tab2 was solved!