开发者

Aligning components at desired positions

Seeking help to design a layout as shown here:

http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eG开发者_运维技巧dyZmc&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.

Any help is much appreciated.

Regards, Rony


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.

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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜