我正在尝试创建一个适用于三星 Galaxy Tab GT P1000 和三星 Galaxy Tab 10.1 的应用程序;三星 Galaxy Tab 10.1 (1280 * 800) 的屏幕比 GT P1000 大得多,所以我假设 GT P1000 应该从 hdpi 读取,而 10.1 应该从 xhdpi 读取。令人惊讶的是,它们都从 mdpi 文件夹中读取。问候
3 回答
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
and Galaxy Tab 10.1
, both have screen resolution of 1280*800
but galaxy tab 10.1 has physical screen size of 10.1 inch
whereas galaxy note has physical screen size of 5.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 has xhdpi
density, where as galaxy tab 10.1 has mdpi
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 use drawable-large-hdpi
folder, if drawable-large-mdpi
does not wok.
And also add xlarge support in your manifest.
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
/>
You have to use 2.3 and above sdk for using xlarge as it was added later.
mdpi
指的是屏幕密度,以每英寸点数为单位,而不是整体尺寸。我认为这两种设备的密度相似,因此它们从mdpi
文件夹中加载资源。
您可以根据实际屏幕尺寸(大/中/小)而不是密度来拥有单独的布局资源。请参阅文档。
只需创建新文件夹名称 drawable-xlarge-mdpi 并将所有图像粘贴到其中.. 设备将自动从该文件夹中获取..!
我的 Galaxy Tab2 问题解决了!