Java 合并两个或多个ImageView
我有4个框架布局,布局中有2个图像视图(一个可见,一个不可见)。单击第一个ImageView后,在Framelayout中,将其旋转到第二个ImageView。如本例所示()。它工作得很好,但是是否有任何选项可以组合两个或多个ImageView?因此,如果我单击第一个图像(android:id=“@+id/HotView1”),我的android:id=“@+id/HotView2”和android:id=“@+id/WarmView2”会作为一个图像一起旋转吗 当然,我可以按顺序旋转每个视图,但这看起来不太好,因为旋转时相机的角度。有什么简单快速的解决方案吗Java 合并两个或多个ImageView,java,android,imageview,Java,Android,Imageview,我有4个框架布局,布局中有2个图像视图(一个可见,一个不可见)。单击第一个ImageView后,在Framelayout中,将其旋转到第二个ImageView。如本例所示()。它工作得很好,但是是否有任何选项可以组合两个或多个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>
[...]
[…]
[...]
首先,为要设置动画的LinearLayout和ImageView提供ID。以便您可以参考它们
然后定义一个函数,使通过的视图具有动画效果,如:
public void myAnimation(View viewToAnimate) {
// Your code for animating which will be comman
}
现在获取LinearLayout和ImageView的引用,检查要设置动画的视图的条件,如:
if(wantToAnimateLinearLayout == true) {
myAnimation(linearLayoutReference);
} else {
myAnimation(imageViewReference);
}
在一个线性或相对布局中添加两个图像可以为整个布局提供动画。但这取决于。。。有时我想结合图像,有时不。我的旋转方法如下所示:私有void applyrotion(float start、float end、ImageView image1、ImageView image2)。所以我需要一个旋转的图像视图