0

I have created a layout in my xml file and have a LinearLayout that is displayed at the top of the activity. I have set its width to fill_parent and its height to 54dp. The height of the layout looks good on devices with bigger screens like Samsung Galaxy, but on smaller devices it looks too big. Is there anyway that the layout will have different height on different screen sizes? I am guessing that this might be achieved by dp, dip, etc. but I'm not sure as to what exactly they do

4

2 回答 2

0

希望对你有帮助...

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation


Low density Small screens QVGA 240x320 

res/layout-small-ldpi
res/layout-small-land-ldpi
Low density Normal screens WVGA400 240x400 (x432)

res/layout-ldpi
res/layout-land-ldpi
Medium density Normal screens HVGA 320x480

res/layout-mdpi
res/layout-land-mdpi
Medium density Large screens HVGA 320x480

res/layout-large-mdpi
res/layout-large-land-mdpi
High density Normal screens WVGA800 480x800 (x854)

res/layout-hdpi
res/layout-land-hdpi
Xoom (medium density large but 1280x800 res)

res/layout-xlarge
res/layout-xlarge-land

如有任何疑问,请评论我...

于 2012-12-05T07:10:51.873 回答
0

制作layout-normal-hdpilayout-normal-mdpilayout-normal-xhdpi文件夹,并在所有三个文件夹中复制相同的 xml,而不是根据设备在每个 xml 上设置不同的高度。这是遵循的标准技术。试试这个,你一定会得到想要的结果。

于 2012-12-05T06:36:49.357 回答