【发布时间】:2015-06-23 12:41:07
【问题描述】:
我的布局中有 4 个 Framelayouts 和 2 个 ImageView(一个可见,一个不可见)。在单击第一个 ImageView 后,在 Framelayout 中,它会旋转到第二个 ImageView。就像在这个例子中一样(http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html)。它工作正常,但是有没有组合两个或多个 ImageView 的选项?因此,如果我单击第一张图片(android:id="@+id/HotView1"),我的 android:id="@+id/HotView2" 和 android:id="@+id/WarmView2" 一起旋转为一个图像?
当然,我可以依次旋转每个视图,但由于旋转时的相机角度,这看起来不太好。有什么简单快捷的解决方案吗?
[...]
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<ImageView
android:id="@+id/HotView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/hot_notactiv" />
<ImageView
android:id="@+id/HotView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/hot_activ" />
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<ImageView
android:id="@+id/WarmView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/warm_notactiv" />
<ImageView
android:id="@+id/WarmView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/warm_activ" />
</FrameLayout>
[...]
【问题讨论】:
-
在一个线性或相对布局中添加两个图像,为整个布局提供动画。
-
但这取决于...有时我想组合图像有时不。我的旋转方法如下所示:private void applyRotation(float start, float end, ImageView image1,ImageView image2)。所以我需要一个 ImageView 来旋转