画像を回転させ、3 つの画像を重ねる必要があるという要件があります。
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:id="@+id/rellay"
tools:context=".MainActivity" >
<com.example.stackableimages.ImageRotatedView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/square"
android:id="@+id/image" />
<com.example.stackableimages.ImageRotatedView2
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/square2"
android:id="@+id/image1" />
</RelativeLayout>
注: でたらめに積み重ねる必要があります。つまり、毎回回転角度が異なります。回転アニメーションは解決策ではありません。3 つの imageviews で相対レイアウトを使用しました。カスタム ビューを作成して onDraw メソッドをオーバーライドする必要がありますか
View.setRotation はこれを実現するのに役立ちますが、 api 11 以降で利用できます。私のアプリは api 7 から互換性があるはずです。Androidでこれを達成するにはどうすればよいですか。上記のコードを使用すると、相対レイアウトを使用しているにもかかわらず、単一の画像しか表示できませんか?