0

http://developer.android.com/guide/practices/screens_support.htmlを読んで、事前スケーリングがどのように機能するかを理解しようとしています。

Galaxy タブ用に最適化された次のレイアウト ファイルがあります。

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayoutmain"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainmenu"
>
<ImageButton
android:id="@+id/start_button"
android:layout_marginLeft="150dip"
android:layout_marginTop ="70dip"
android:layout_width="500dip"
android:layout_height="214dip"
android:background="@drawable/startsession"
android:contentDescription="@string/descbuttonstart"
/>

画面の画像を drawable-ldpi フォルダーに配置しました。問題は、(エミュレーターを使用して) 小さな画面でアプリをテストすると、画面が適切にスケーリングされないことです。ボタンが大きく、正しく配置されていません。

すべての画面に 1 つのレイアウト ファイルを使用することは可能ですか?もしそうなら、これを機能させる秘訣は何ですか?

ありがとうございました。

4

2 に答える 2

0

画面サイズと画面解像度は2つの独立したものです。ldpiフォルダーのリソースは低解像度用であり、必要な小さな画面サイズではありません。私が好む方法は、高解像度のリソースを定義し、他のリソースにスケールダウンさせることです。

于 2012-05-22T09:22:16.587 に答える
0

いいえ、私の知る限り、ボタン、画像などのサイズが異なる3つの異なるフォルダー(hdpi、mdpi、ldpi)が必要であり、レイアウトにも3つのレイアウトフォルダー(layout-small、layout-medium、layout)が必要です。 -大きい)

于 2012-05-22T09:50:57.490 に答える