次のようなレイアウトを開始しました。
しかし、3 つの ImageView (赤) を正確な位置に移動するのに苦労しています。これは私が得ることができる限りです:
今私の問題は、3 つの ImageView をクリック可能に設定して、対応する画面にルーティングしたかったことですが、translateY を使用して ImageView(blue) を下に移動するだけなので、レイアウトに適用できませんでした。 . 実際の ImageView(blue) の配置は、ImageView(aqua) の実際の表示より 60 dp 上にあります。したがって、クリックしても何の影響もありません。ここに私のxmlがあります:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mypage_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/silver" >
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/table_1"
android:layout_width="match_parent"
android:layout_height="180dp"
android:adjustViewBounds="true"
android:background="@color/green" />
<ImageView
android:id="@+id/btn_top_page"
android:layout_width="match_parent"
android:layout_height="50dp"
android:adjustViewBounds="true"
android:background="@color/maroon"
android:clickable="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/relative_left"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/relative_center" >
<ImageView
android:id="@+id/btn_left"
android:layout_width="60dp"
android:layout_height="60dp"
android:clickable="true"
android:src="@color/aqua"
android:translationY="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_left"
android:layout_centerHorizontal="true"
android:text="Left"
android:textColor="#FFFFFF"
android:translationY="65dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" >
<ImageView
android:id="@+id/btn_center"
android:layout_width="60dp"
android:layout_height="60dp"
android:clickable="true"
android:src="@color/fuchsia"
android:translationY="70dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_center"
android:layout_centerHorizontal="true"
android:text="Center"
android:textColor="#FFFFFF"
android:translationY="75dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_right"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/relative_center" >
<ImageView
android:id="@+id/btn_right"
android:layout_width="60dp"
android:layout_height="60dp"
android:clickable="true"
android:src="@color/gray"
android:translationY="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/btn_right"
android:layout_centerHorizontal="true"
android:text="Right"
android:textColor="#FFFFFF"
android:translationY="65dp" />
</RelativeLayout>
</RelativeLayout>
</FrameLayout>
これはコードがすべきことですか?どんな助けでも構いません。どうもありがとうございました。