私は現在、画面の上部にイメージビュー (画面の上部から 10% のギャップがある) と、イメージビューの下に 4 つのボタンがあるテーブルが必要なアプリを作成しています。
私が今持っているものは次のとおりです。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/testhback"
android:gravity="bottom" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/f1"
android:adjustViewBounds="true"
android:src="@drawable/img1" />
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/top2"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/button4"
android:onClick="changepic2"
android:text="Breaking Dawn" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button1"
android:layout_alignBottom="@+id/button1"
android:layout_alignLeft="@+id/button5"
android:layout_alignParentRight="true"
android:onClick="changepic3"
android:text="New Moon (2)" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button3"
android:layout_alignParentLeft="true"
android:onClick="changepic"
android:text="Twilight (1)" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:onClick="changepic1"
android:text="Eclipse (3)" />
</TableRow>
</TableLayout>
問題は、テーブルの上からマージンを設定しようとしたことです。しかし、各画面では見た目が異なり、自動的に取得するように指示する方法がわかりませんでした。たとえば、その下のトップラインに 10%、イメージビューに 70%、4 ボタンがあるテーブルに 20% とします。それを一番下に。