如何从它的中心位置转动imageview的 [英] how to rotate imageview from its centre position
本文介绍了如何从它的中心位置转动imageview的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从它的中心位置移动我的的ImageView
。 的ImageView
的那一面去上面并在此之后的ImageView的另一边
应该归结的ImageView中心
总是修复。如何做到这一点我的code是
i want to move my Imageview
from its center position. that one side of imageview
goes above and after this the other side of imageview
should comes down
centre of imageview
always fix. how to do this my code is
imageView= (ImageView) findViewById(R.id.imageView1);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
RotateAnimation animation = new RotateAnimation(80, 90, imageView.getWidth() / 2, 400);
animation.setDuration(400); // you may set another duration
animation.setFillAfter(true);
imageView.startAnimation(animation);
}
});
<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" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="86dp"
android:src="@drawable/top_pati" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_below="@+id/imageView1"
android:src="@drawable/top_pativertical" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/imageView1"
android:layout_below="@+id/imageView1"
android:src="@drawable/top_pativertical" />
样的规模型
我做哪种类型的动画这份工作......
like scale type which type of animation i do this job...
推荐答案
使用code
RotateAnimation anim = new RotateAnimation(0, 45, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(500);
anim.setFillEnabled(true);
anim.setFillAfter(true);
image.startAnimation(anim)
这篇关于如何从它的中心位置转动imageview的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文