[英]How to run an Android app on both 7-inch table and 10-inch tablet
I am creating an app for both a 10-inch and a 7-inch tablet. 我正在为10英寸和7英寸平板电脑创建一个应用程序。
My problem is, on the 10 inch tablet it's not working well. 我的问题是,在10英寸平板电脑上,它无法正常工作。 On the 7-inch one it is. 在7英寸之一上。 I copied small images in the hdpi folder and big images in the xhdpi folder. 我在hdpi文件夹中复制了小图像,在xhdpi文件夹中复制了大图像。 I tried using below way but I am getting a problem on 10-inch tablets. 我尝试使用下面的方法,但是在10英寸平板电脑上出现问题。 Here images looking small like that. 这里的图像看起来很小。 I thought the 10 inch tablet was also taking hdpi folder images. 我以为10英寸平板电脑也可以拍摄hdpi文件夹图像。 The app is in landscape mode. 该应用程序处于横向模式。
How to make this app for both tablets? 如何为两种平板电脑制作此应用程序?
XML files: XML文件:
res/layout-large/main.xml -----7 inch
res/layout-xlarge/main.xml -----10 inch
Images: 图片:
res/drawable/hdpi---7 inch images
res/drawable/xhdpi---10 inch images
Table dimensions 7 inch: 桌子尺寸7英寸:
1024 to 600
density 240
ramsize 512
version 3.0
Table dimentions 10 inch: 表尺寸10英寸:
1280 to 800
density 160
ramsize 512
version 3.0
You've got to use the new qualifiers at the bottom of http://developer.android.com/guide/practices/screens_support.html 您必须在http://developer.android.com/guide/practices/screens_support.html底部使用新的限定词
For example 例如
res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
HDPI is for density ~= 240 HDPI用于密度〜= 240
XHDPI is for density ~= 300 XHDPI用于密度〜= 300
Your 10 inch tablet is density 160, which is MDPI. 您的10英寸平板电脑的密度为160,即MDPI。
Also LARGE & XLARGE depends on the screen size (resolution), but your drawable folders depend on the screen density, which is not the same thing. 同样,大和大取决于屏幕尺寸(分辨率),但是可绘制文件夹取决于屏幕密度,这不是同一回事。
Here are all the infos you need : http://developer.android.com/guide/practices/screens_support.html 这是您需要的所有信息: http : //developer.android.com/guide/practices/screens_support.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.