本文介绍了如何布局设置为Galaxy Nexus的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android 2.2应用程序。

I'm developing an Android 2.2 application.

测试我的布局与Eclipse图形布局我有一个问题:它并不好看Galaxy Nexus的

Testing my layout with eclipse graphical layout I have a problem: it doesn't look good on Galaxy Nexus.

我有四个图像类型:LDPI,MDPI,华电国际和xhdpi。布局和四个dimens.xml文件(LDPI,MDPI,华电国际和xhdpi)。

I have four image types: ldpi, mdpi, hdpi and xhdpi. A layout and four dimens.xml files (ldpi, mdpi, hdpi and xhdpi).

如果我修改dimens.xml使其看起来很好用 Galaxy Nexus的,但它不会很好看在其他设备,如: 的Nexus One (在Eclipse图形布局)。所以,我想我需要别的东西。

If I modify dimens.xml to make it look well with Galaxy Nexus but it won't look well on other device, e.g. Nexus One (in eclipse graphical layout). So, I think I need something else.

阅读支持我看到有另一种方法多画面:而不是使用正常的,大的,等的布局,我可以使用开关< N> DP 。但是,这已经开始与Android 3.2,我需要支持Android 2.2。

Reading Supporting Multiple Screens I see there is another approach: instead of using normal, large, etc layout, I could use sw<N>dp. But this is beginning with Android 3.2, and I need to support Android 2.2.

什么我需要添加,使其看起来很好的Galaxy Nexus的?

的Nexus One

Nexus One:



Galaxy Nexus的



Galaxy nexus:

推荐答案

另一种方法我经常发生用它来思考,如Web开发人员。试着让你的版面好看的布局拉伸以任何方向。居中的重要组成部分,并确保形象背后可以在两个方向上被拉长。然后使用ImageView的背景和将其设置为match_parent和scaletype到centerCrop。它不为一切工作,但我是pretty的知道它会为您的样品。

Another approach I often happen to use it to think like web developers. Try to make your layout look good with layout stretched in whatever direction. Center the important part and make sure the image behind can be stretched in both directions. Then use an imageview for the background and set it to match_parent and scaletype to centerCrop. It doesn't work for everything but I'm pretty sure it would work for your sample.

在你的情况,你可以把所有的东西,你现在所拥有的另一个容器内(例如RelativeLayout的),那么你居中,并设置尺寸或使其WRAP_CONTENT。然后,新的顶级容器应match_parent,并有我谈到作为一个孩子ImageView的。

In your case you could put everything you have right now inside another container (for example a RelativeLayout) then you center it and set the dimensions or make it wrap_content. The new top container should then match_parent and have the imageview I talked about as a child.

这篇关于如何布局设置为Galaxy Nexus的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 08:29