次のレイアウトを作成したいと思います。下の図を参照してください。ここでは、EditText ビューの場所が矢印に対して正しい位置にとどまっています。
以下のレイアウトは余白を利用する RelativeLayout で作成しましたが、HTC センセーションのような 540x960 解像度の電話にこのアプリをインストールすると機能しません。
よろしくお願いします。
次のレイアウトを作成したいと思います。下の図を参照してください。ここでは、EditText ビューの場所が矢印に対して正しい位置にとどまっています。
以下のレイアウトは余白を利用する RelativeLayout で作成しましたが、HTC センセーションのような 540x960 解像度の電話にこのアプリをインストールすると機能しません。
よろしくお願いします。
LinearLayout と RelativeLayout を組み合わせて使用します。LinearLayout を使用すると、すべてのデバイスでまったく同じになるスペースを画面上に作成できます。トップレベルのコンテナを LinearLayout にします。たとえば、参照した画像の 2 行目を作成するには、次のようにします。
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</TextView>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</RelativeLayout>
</LinearLayout>