xml ファイルにレイアウトを作成し、アクティビティの上部に LinearLayout を表示しています。幅をfill_parent
に、高さを に設定しました54dp
。レイアウトの高さは、Samsung Galaxy のような大画面のデバイスでは適切に見えますが、小さいデバイスでは大きすぎます。異なる画面サイズでレイアウトの高さが異なるということはありますか? これは dp や dip などで実現できるのではないかと推測していますが、正確に何をしているのかはわかりません。
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-hdpi、layout -normal-mdpi、およびlayout-normal-xhdpiフォルダーを作成し、3 つのフォルダーすべてに同じ xml をコピーして、デバイスごとに各 xml に異なる高さを設定します。これは、従われてきた標準的な手法です。これを試してみると、きっと望ましい結果が得られます。
于 2012-12-05T06:36:49.357 に答える