在所需的位置对齐组件 [英] Aligning components at desired positions

查看:139
本文介绍了在所需的位置对齐组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻求帮助设计一个布局,如下所示:

Seeking help to design a layout as shown here:

http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en

我所面临的主要挑战是调整的组件在所需的位置。请参阅三个按钮(图标),并且它们被定位的方式。

The major challenge I face is aligning the components at desired positions. Please refer the three buttons(icons) and the way they are positioned.

从字面上看,要疯了,想着如何定位这些正好在希望的地方。

Literally, going nuts, thinking how to position those exactly at the desired places.

任何帮助是非常AP preciated。

Any help is much appreciated.

问候, 罗尼

推荐答案

由于您使用的是Android类别,我假设你正在试图重新在Android的这款iPhone布局。

Since you used the Android category, I'm assuming that you're trying to recreate this iPhone layout in Android.

三个按钮很可能是最好奠定如下:

The three buttons would probably be best laid as follows.

您主要布局容器可能是一个RelativeLayout的,所以你可以停靠的东西顶端和底部打下一切在关系到它的同级元素之一。这三个按钮图标(我假设你指的是圆形按钮,而不是标签栏按钮在最底层)将是其母公司中居中一个LinearLayout中(可能需要利用重力= center_horizo​​ntal主外布局),并且单个项目将有一个等于左和右边缘参数,以获得所需的间距(layout_marginLeft,layout_marginRight)。你还可以使冲洗的按钮的LinearLayout容器(layout_width = FILL_PARENT),并使用机器人:在外按钮重量属性铺设出来向中心,并使用较低的权重上的中心项目。我倾向于第一种选择,个人。

Your main layout container would probably be a RelativeLayout, so you can dock things to the top and bottom and lay everything else out in relation to one of its sibling elements. The three button icons (and I'm assuming you're referring to the circular buttons and not the tab bar buttons at the very bottom) would be in a LinearLayout centered within its parent (probably want to use gravity=center_horizontal on the main outer layout) and the individual items would have an equal left and right margin parameters to get the desired spacing (layout_marginLeft, layout_marginRight). You could also make the LinearLayout container of the buttons flush (layout_width=fill_parent) and using android:weight attribute on the outer buttons laying them out towards the center and using a lower weight on the center item. I'd favor the first option, personally.

如果你想创建相对复杂的布局和上述任何没有意义,回去和阅读文档。布局Android是非常强大的,但你一定要了解可用的工具来利用它。

If you're trying to create relatively complex layouts and any of the above doesn't make sense, go back and read the docs. Layout in Android is very powerful, but you really have to understand the available tools to take advantage of it.

这篇关于在所需的位置对齐组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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