android 3d 旋转
2010-10-12 02:45:00 来源:本站整理//下面两句很关键哦,呵呵,心照不宣。
Rotate3d leftAnimation = new Rotate3d(-0, -90, 0, 0, mCenterX, mCenterY);
Rotate3d rightAnimation = new Rotate3d(-0+90, -90+90, 0.0f, 0.0f, mCenterX, mCenterY);
leftAnimation.setFillAfter(true);
leftAnimation.setDuration(1000);
rightAnimation.setFillAfter(true);
rightAnimation.setDuration(1000);
mImageView1.startAnimation(leftAnimation);
mImageView2.startAnimation(rightAnimation);
还要写一下mImageView1,mImageView2的xml,
Java代码
1. < ?xml version="1.0" encoding="utf-8"?>
2. < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3. android:orientation="vertical"
4. android:layout_width="fill_parent"
5. android:layout_height="wrap_content"
6. >
7.
8. < FrameLayout
9. android:layout_width="fill_parent"
10. android:layout_height="fill_parent">
11.
12. < ImageView
13. android:id="@+id/image1"
14. android:layout_gravity="center_horizontal"
15. android:layout_width="fill_parent"
16. android:layout_height="wrap_content"
17. android:src="@drawable/image1"
18. />
19. < ImageView
20. android:id="@+id/image2"
21. android:background="#ffff0000"
22. android:layout_gravity="center_horizontal"
23. android:layout_width="fill_parent"
24. android:layout_height="wrap_content"
25. android:src="@drawable/image2"
26. />
27.
28. < /FrameLayout>
29. < /LinearLayout>
< ?xml version="1.0" encoding="utf-8"?>
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
更多精彩
赞助商链接