开发者

Android View Design Issues

I've been playing about with the layout of a view with Android (lets say within the MainActivity) and I'm looking to create this sort of layout using 3 ImageView's (where each block represents an image):

Android View Design Issues

This is rather easy to pull of using LinearLayout's but only if you specify the exact size and position of each ImageView. This then obviously causes problems when looking at different screen sizes.

Using AbsoluteLayout looked like it was going to work at first, but I've read that it's deprecated and it still causes problems with different screen sizes.

Then there is RelativeLayout, which I've tried using with DroidDraw,开发者_如何学Go but it doesn't seem to get me very far when I implement it :(

So, does anyone have an ideas of how to achieve this?

EDIT: I've got close to doing this using dp instead of px but this still gets screwed up when using larger resolution devices! :(

Thanks


Romain Guy does something very similar using RelativeLayout. Android Layout Tricks #1


One solution is that you could use a TableLayout with 2 columns, and then in the second column embed a second TableLayout.

DroidDraw doesn't always show exactly how it will work when it runs 100% of the time I've noticed.


You can do this with a horizontal LinearLayout: add the green first, then add a vertical liner layout for the blue and orange and give each an appropriate weight (like 50 and 50).


You can still use LinearLayout but make the width/height in dip units. Thatvway it should look the same on any supported screen size. Alternativly, you could use the weight attribute instead which is probably a better idea for this case.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜