本文介绍了Android的我怎么支持不同手机的版本和屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一些应用程序的用户是在Android 1.5上,有的落在1.6和2.0部分。

Some of my application's users are on android 1.5, some on 1.6, and some 2.0.

那么,如何发布我的应用程序为所有的客户?如果我发布了1.5版,那么1.5的手机可以使用它 - 但不是在较小的屏幕(又名刺青)较新的手机,他们需要1.6或更高版本?是否正确?

So how do I release my app for all customers? If I release a 1.5 version, then the 1.5 phone can use it - but not the newer phones with smaller screens (aka Tatoo), they require 1.6 or higher? correct?

感谢

推荐答案

我要做的就是把我的应用程序来构建针对Android 1.6的,然后我在清单设置中的minSdkVersion为3(它告诉市场,让Android 1.5的手机安装它,并targetSdkVersion 4(它告诉手机与Android 1.6及更高版本,我已经测试了1.6,而不是给它的向前兼容帮助),通过构建对1.6,Eclipse将不会让我用任何2.0 API的,但我知道它会仍然在1.6和2.0。它也将不会让你自动地在1.5模拟器安装它,所以我出口签署的APK,然后使用亚行工具随附SDK上通过命令行模拟器安装和手工测试,以确保它不会踩到任何特定1.6的API无论是。

What I do is set my app to build against Android 1.6, then I set the minSdkVersion in the manifest to 3 (which tells the Market to let Android 1.5 phones install it, and the targetSdkVersion to 4 (which tells phones with Android 1.6 and up that I've already tested it on 1.6 and not to give it any forward-compatibility help). By building against 1.6, Eclipse won't let me use any 2.0 APIs, but I know that it will still work on 1.6 and 2.0. It also won't let you automagically install it on a 1.5 emulator, so I export a signed APK and then use the "adb" tool that comes with the SDK to install it on the emulator via the command line, and hand-test it to make sure it's not stepping on any 1.6-specific APIs either.

我不反对建1.5的原因是,有东西只在1.6及更高版本,我需要使用,那将1.5忽略,那就是多种屏幕尺寸的支持。我可以包括意味着在res /绘,华电国际在Droid屏幕更大的资产和拥有机器人自动加载的,但如果我对建设1.5,Eclipse不知道我想要做的。

The reason I don't build against 1.5 is that there is stuff only in 1.6 and up that I need to use, that 1.5 will safely ignore, and that is support for multiple screen sizes. I can include larger assets meant for the Droid screen in res/drawable-hdpi and have Droids autoload those, but if I'm building against 1.5, Eclipse doesn't know what I'm trying to do.

我希望我没有做那个声音太复杂了,因为它实际上不是 - 在Android SDK和资源框架使得它非常容易处理多个屏幕大小和平台的版本。才明白这是你在做什么,并在布局XML使用屏幕独立像素单元,你会没事的。

I hope I didn't make that sound too complicated, because it actually isn't - the Android SDK and resource framework makes it surprisingly easy to handle multiple screen sizes and platform versions. Just understand what it is you're doing, and use screen-independent pixel units in your layout XML, and you'll be fine.

这篇关于Android的我怎么支持不同手机的版本和屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 16:28
查看更多