简体   繁体   English

如何在7英寸台式机和10英寸平板电脑上运行Android应用

[英]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.

相关问题 我需要7英寸和10英寸Android平板电脑的屏幕截图吗? - Do I need screenshots for both 7-inch and 10-inch Android tablets? 如何使我的应用仅适用于移动设备和7英寸平板电脑,而不能用于9和10英寸平板电脑? 请查看详细信息 - How can I make my app available only for mobiles devices & 7-inch tablets, but not for 9 & 10-inch tablets? Please see details 如何使用相同的版本制作应用程序的10英寸平板电脑版本? - How can I use the same build to make a 10-inch tablet version of my app? 如何使10英寸平板电脑代码与Android中的7英寸平板电脑兼容 - How make 10 inch tablet code compatible to 7 inch tablet in android 如何为10英寸平板电脑优化应用程序? - How to optimize the app for 10 inch tablet? 如何在Android中仅以人像模式设计10英寸平板电脑? - How to design in 10 inch tablet only in portrait mode in Android? 仅发布7和10英寸平板电脑的Android应用程序 - Publish Android application for 7 and 10 inch tablet only 如何指定适用于7英寸平板电脑的应用程序? - How to specify an application to work for 7-inch tablets? 以编程方式检测 7 英寸和 10 英寸平板电脑 - Detect 7 inch and 10 inch tablet programmatically 支持9.6英寸和10.1英寸android平板电脑 - Supporting 9.6 inch and 10.1 inch android tablet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM