次のようなアクティビティがあります。
エミュレーターでアプリを実行すると、画鋲がポストイットの上にないため、画面サイズが異なると問題が発生することがわかっています。ポストイットとコルクボードが背景です。どのようなサイズの画面でも、画鋲が正しい位置に表示されるようにするにはどうすればよいでしょうか? 現在は直線レイアウトです。
上記の推奨事項に基づいて、次のようにします。
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:src="@drawable/postit"/>
<ImageButton
android:id="@+id/angry_btn"
android:background="@drawable/pushpin"
android:layout_width="80dp"
android:layout_height="80dp"
android:shadowDx="0"
android:shadowDy="0"
android:layout_gravity="center"
android:shadowRadius="5"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"/>
</RelativeLayout>
注: 一番外側のレイアウトの背景として茶色の部分を作成し、付箋の別の画像を用意して、上に示した画像ビューに設定する必要があります。