左から右にゆっくりと表示されるように、ImageView をアニメーション化しようとしています。以前こちらに伺った際、何が欲しいのか説明がつかず困っていたので、今回はHTML/JSを使って希望のエフェクトを作成しました。
Android でこの効果を得るための最良の方法は何でしょうか?
scaleType を変更してから、ScaleAnimation をその ImageView に直接適用してみました。
レイアウト:
<ImageView
android:id="@+id/graphImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
android:background="@android:color/transparent"
android:contentDescription="@string/stroom_grafiek"
/>
ジャワ:
scale = new ScaleAnimation((float)0,
(float)1, (float)1, (float)1,
Animation.RELATIVE_TO_SELF, (float)0,
Animation.RELATIVE_TO_SELF, (float)1);
scale.setDuration(1000);
graphImage.startAnimation(scale);
しかし、これはまだ画像をスケーリングします。
また、FrameLayout をアニメーション化できることを期待して、ImageView を FrameLayout でラップしようとしました。
<FrameLayout
android:layout_width="70dp"
android:layout_height="fill_parent"
android:clipChildren="true"">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left|clip_horizontal" />
</FrameLayout>
これは、FrameLayout 内に収まるように ImageView をスケーリングしようとします。