如何确定目标在Android的布局文件夹的1280×720分辨率WXGA720(如新Galaxy Nexus的)? [英] How do I target 1280x720 WXGA720 resolution (like new Galaxy Nexus) in Android Layout folders?

查看:246
本文介绍了如何确定目标在Android的布局文件夹的1280×720分辨率WXGA720(如新Galaxy Nexus的)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的测试,在对Android模拟器WXGA720分辨率的应用程序运行4.0.3冰淇淋三明治,我的应用程序从布局,正常的土地854×480文件夹中的横向视图和布局端口,小480x320文件夹需要的布局资产纵向视图。我希望能够专门针对这一决议让我的应用程序正确地显示在新的手机。我该怎么做呢?我曾尝试以下...

布局正常土地xhdpi
布局正常的端口,xhdpi
布局正常土地XLARGE
布局正常的土地大
布局正常土地1280×720
布局正常端口1280×720,等...

......,它仍然从上面详述了错误的文件夹需要的资产。

我的应用程序的目标是Android 2.1的(我认为仍然是标准的目标,这些天),所以我不能因为据我所知使用新的布局预选赛。这是一个错误?有没有人有同样的问题,发现一个解决办法?

我有以下文件夹配置,和所有其他的AVDS的按预期显示:

布局
布局土地
布局正常的土地小480x320
布局正常土地854×480
布局端口,小480x320
布局端口800×480

解决方案
  

在测试我的应用程序,在对Android模拟器WGXA720分辨率运行4.0.3冰淇淋三明治,我的应用程序从布局,正常的土地854×480文件夹中的横向视图和布局端口,小480x320文件夹需要的布局资产纵向视图。

如果我猜的话,你没有一个有效的<支持屏> 元素(也可能没有安卓的minSdkVersion )在你的清单,并让你被扔进一个兼容模式。

另外,请不要使用像 -480x320 -854x480 后缀。这是从有原因的文件中删除。无论什么问题,你认为你正在解决他们可以更好地解决了一些其他的方式。

  

我的应用程序的目标是Android 2.1的(我认为仍然是标准的目标,这些天),所以我不能因为据我所知使用新的布局预选赛。

您可以设置您的构建目标向更高层次,并使用新的布局预选赛。然而,旧设备会忽略他们,所以你仍然需要使用 -Normal -land 和亲属为他们在与任何资源平行设置与新的预选赛。您可以创建资源别名,以尽量减少code复制。

When testing my application at WXGA720 resolution on the Android Emulator running 4.0.3 Ice Cream Sandwich, my app takes the layout assets from the layout-normal-land-854x480 folder in landscape view and the layout-port-480x320 folder for portrait view. I would like to be able to specifically target this resolution so my app displays properly on the new phones. How do I do this? I have tried the following...

layout-normal-land-xhdpi
layout-normal-port-xhdpi
layout-normal-land-xlarge
layout-normal-land-large
layout-normal-land-1280x720
layout-normal-port-1280x720, etc...

...and it still takes the assets from the wrong folders detailed above.

My app is targeting Android 2.1 (which I assume is still the standard target these days), so I can't as far as I know use the new layout qualifiers. Is this a bug? Has anyone had this same issue and found a workaround?

I have the following folder configuration, and all of the other AVDs display as expected:

layout
layout-land
layout-normal-land-480x320
layout-normal-land-854x480
layout-port-480x320
layout-port-800x480

解决方案

When testing my application at WGXA720 resolution on the Android Emulator running 4.0.3 Ice Cream Sandwich, my app takes the layout assets from the layout-normal-land-854x480 folder in landscape view and the layout-port-480x320 folder for portrait view.

If I had to guess, you do not have a valid <supports-screens> element (or possibly no android:minSdkVersion) in your manifest, and so you are being thrown into a compatibility mode.

Also, please don't use suffixes like -480x320 and -854x480. These were removed from the documentation for a reason. Whatever problem you think you are solving with them can be better solved some other way.

My app is targeting Android 2.1 (which I assume is still the standard target these days), so I can't as far as I know use the new layout qualifiers.

You can set your build target to a higher level and use the new layout qualifiers. However, older devices will ignore them, so you will still need to use -normal and -land and kin for them, in parallel with any resource sets with the new qualifiers. You can create resource aliases to minimize code duplication.

这篇关于如何确定目标在Android的布局文件夹的1280×720分辨率WXGA720(如新Galaxy Nexus的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆