开发者

Positioning Android UI

Basically I'm developing a user interface similar to this:

http://ivitto.files.wordpress.com/2008/09/tap-tap-home.jpg?w=160&h=240

Where there are a series of buttons stored in a linear layout. My problem is at the moment they are centered along the x axis and the y axis so they are in the middle of the screen rather than in the lower half of the screen as in the image. The only way I can get what I want to work is by adding 100px or so "top padding" but of course the amount of pixels required is entirely variable on the screen resolution. Whilst this 100px is fine for a 4开发者_Go百科80x320 screen it is far too small for a 1024x600 screen. So basically I'm asking how can I align my linear layout at the bottom of its parent (another linear layout)


Have you tried setting the gravity parameter of the linearlayout to bottom ?


Yes, try gravity bottom. And by the way. You can use "dip" (density independent pixel ( http://developer.android.com/guide/practices/screens_support.html#density-independence ))instead of px for the padding. Although setting the gravity is surely the nicer way in this case...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜