不同的图形用户界面的手机和平板电脑,但相同的应用程序的问题平板、用户界面、应用程序、图形

由网友(随你沧桑)分享简介:好吧,我有以下的情况,我想获得一些assits,如果可能的话。我必须写一个应用程序的平板电脑和手机了。这两个应用程序具有相同的功能,但它们有绝对不同的图形用户界面。 Okay, I have the following situation and I would like to get some assits, i...

好吧,我有以下的情况,我想获得一些assits,如果可能的话。 我必须写一个应用程序的平板电脑和手机了。这两个应用程序具有相同的功能,但它们有绝对不同的图形用户界面。

Okay, I have the following situation and I would like to get some assits, if it is possible. I have to write an app for tablet and for phones too. The two app has the same functionality, but they have absolute different GUI.

例如电话有主屏幕上的2键,但平板电脑将有5个,因为我们想用空间我们所拥有的。我知道,I~m能够定义不同的布局,取决于DPI,但是我应该如何处理布局-S的活力的影响?我认为,使用IF(sdkVersion> = 11)bla..bla ......是不是会工作过孔code和孔项目!这是我不得不使用多个应用程序支持的情况?

For example the phone have 2 button on the main screen, but the tablet going to have 5, because we would like to use the space what we have. I know, I˜m able to define different layouts, depends on dpi, but how should I handle the layout-s in the Activiies? I think, to use if(sdkVersion >=11) bla..bla... is not will works through the hole code and the hole project! Is this the situation where I have to use multiple application support ?

readed文章: http://developer.android.com/guide/practices/screens_support.html

readed articles: http://developer.android.com/guide/practices/screens_support.html

http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

http://developer.android.com/guide/market/发布/多apks.html

我不`吨明白我应该如何处理这个问题?请你能帮忙,THX

I don`t understand how should I handle this problem... please if you able help , thx

推荐答案

把你的平板电脑的布局在 RES /布局大/ 。把你的手机布局中 RES /布局/ 。它们命名一样。您的活动将调用合适的人根据运行它们的设备。当你调用 findViewById()检索额外的按钮,看看你得到返回,不理会他们。

Put your tablet layouts in res/layout-large/. Put your phone layouts in res/layout/. Name them the same. Your activities will load the right ones based upon the device they run on. When you call findViewById() to retrieve the extra buttons, and see that you get null back, ignore them.

您可能需要的地方附加布局像 RES /布局大陆/ (景观为片剂), RES /布局XLARGE / (如果你想片不同的东西比在5-9处理10+范围), RES /布局小/ (如果要处理3;屏幕)等

You may need additional layouts in places like res/layout-large-land/ (landscape for tablets), res/layout-xlarge/ (if you want to handle 10+" tablets differently than stuff in the 5-9" range), res/layout-small/ (if you want to handle <3" screens), etc.

阅读全文

相关推荐

最新文章