开发者

Layout Galaxy S2 and HTC Sensation

Do I see the same layout on Galaxy S2 and HTC Sensation.

I think they are both normal-large or large-hdpi, but have开发者_C百科 a different density and therefore the layout is not identical.

It 'just that they have a different density? And how do I manage this thing?


Because the devices have different screens (size, pixel density, resolution), it will always look different on the devices. Unless you specify a layout for each different screen, the layout you defined will be scaled approprietly to the screen. This often comes out almost the same, IF you have used mostly 'density independent pixels'(dip) for the measurements.

EDIT
In the onCreate method in your activity you could first obtain the devices name by using

 android.os.Build //read http://developer.android.com/reference/android/os/Build.html#MODEL

and then use setContentView to set the desired layout.xml

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜