複数の画面サイズをサポートし、すべての画面が縦向きになる Android 2.2.2 アプリケーションを開発しています。風景はサポートしません。
HTC Desire と Samsung Galaxy Tab 7.7 で次のレイアウトをテストしました。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/no_conectado"
android:orientation="vertical" >
<TextView
android:id="@+id/labelSelGateName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="80dp" />
<TextView
android:id="@+id/labelSelOpened"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<ProgressBar
android:id="@+id/indicatorActivityView"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="22dp"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="110dp"
android:layout_marginTop="60dp"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/btnMyGates"
android:layout_width="50dp"
android:layout_height="110dp"
android:layout_marginLeft="20dp"
android:layout_weight=".33"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onGateClick" />
<LinearLayout
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_weight=".33"
android:orientation="vertical" >
<ImageButton
android:id="@+id/btnOpen"
android:layout_width="90dp"
android:layout_height="55dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onOpenDoorClick" />
<ImageButton
android:id="@+id/btnClose"
android:layout_width="90dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onCloseDoorClick" />
</LinearLayout>
<ImageButton
android:id="@+id/btnOptions"
android:layout_width="50dp"
android:layout_height="110dp"
android:layout_marginRight="20dp"
android:layout_weight=".33"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onOptionClick" />
</LinearLayout>
<ImageButton
android:id="@+id/btnFaqs"
android:layout_width="110dp"
android:layout_height="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onFAQClick" />
<ImageButton
android:id="@+id/btnInfo"
android:layout_width="110dp"
android:layout_height="60dp"
android:layout_gravity="right"
android:layout_marginTop="20dp"
android:background="@null"
android:contentDescription="@string/layout_empty"
android:onClick="onInfoClick" />
</LinearLayout>
ldpi、mdpi、hdpi、x-hdpi のイメージがあります。
背景画像は見栄えがしますが、Samsung Galaxy Tab でテストすると、すべてのウィジェット ( TextView
、ProgressBar
、ImageButton
など) が正しい位置にありません。
「Nexus One」をモデルとしてEclipse上でこのレイアウトを設計しました。
ここでは、画面サイズと密度ごとに 1 つのレイアウトのみを使用することをお勧めしますが、うまくいきません。dp
単位 やなどを使用してfill_parent
いますが、Galaxy Tab では異なります。
x-large
画面サイズのレイアウトは必要ですか?