开发者

how to set UI for all resolutions in android

hi i am a new developer and i am being a trainee now, i working on UI part of an app. How can i design the UI of my app to be fitted for all resolutions.

I am using droid draw for placing the positions. In that i will be having the screen size to be as HVGA portrait, when i run it in a QVGA device the positions get moved. For this in my coding i used to give as if(width = 480 && height == 854) the positions must be so and so. This gives good effect in those resolutions only, but when i run it in 480x800 or other devices the problem continues. How to overcome these problems. Am i doing the UI part in a right way?? if not please help me... i my place i dont have anyone to teach me please开发者_StackOverflow社区 help me friends........


I think you should use RelativeLayout in order to generalize your app UI for all kind of screen resolutions.


The two most popular methods to solve this are:

1) Setup templates for the most popular resolutions, landscape and portrait. Retrieve the resolution and set it up accordingly.

2) Use percentages to calculate where to put items. In other words, put this item 30% from the left edge. If it's 1000 pixels wide, it would start at 300 through simple math.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜