开发者

Layout Problem on Bigger resolution Phone like Nexus one?

i have created application using layout font sizes in "pixels" font and other layout looks fine on HTC hero and Motorola Droid but in nexus one which is bigger resolution phone every thing is messed up.

for example ,

i have used font 18px which is bigger size in HTC Hero and Motorola but in Nexus one it is looking very small.

same is the case with image height and width

a banner looks fine on both phones but in ne开发者_运维百科xus one very small. actually we dont have height and width in percentage thats why i am not able to solve this problem. layout_width="fill_parent" also not helping..

kindly help me out what should i do to make application look same in all the phones with different resolutions.


Pixels are the wrong unit. You want to use either real world measurements or "scaled pixels". The Android SDK recommends using scaled pixels (sp) when working with fonts as those are scaled based on any font settings. Other UI elements should be laid out using "density pixels" (dp) which are pixels scaled for higher density screens.


I'd start using sp and dips instead of px. What is the difference between "px", "dp", "dip" and "sp" on Android? Then i would rethink UI and change it so you don't need to specify layouts in fixed dimensions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜