标签:android blog http io ar java sp 2014 on
============问题描述============
public class MainActivity extends Activity { private Button btn; private ImageView ia, ib; private int i = -90; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.button); ia = (ImageView) findViewById(R.id.imageView1); ib = (ImageView) findViewById(R.id.imageView2); ia.setPivotX(100); ia.setPivotY(0); ib.setPivotX(100); ib.setPivotY(200); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ObjectAnimator oa = ObjectAnimator.ofFloat(ib, "rotationX", -90, 0); // ObjectAnimator oa2 = ObjectAnimator.ofFloat(i2, "pivotY", 200, // 0); ObjectAnimator oa3 = ObjectAnimator.ofFloat(ia, "rotationX", 0, 90); // ObjectAnimator oa4 = ObjectAnimator.ofFloat(i1, "pivotY", 200, // 0); ; oa.setDuration(10000); // oa2.setDuration(10000); oa3.setDuration(10000); // oa4.setDuration(10000); oa.setInterpolator(new LinearInterpolator()); // oa2.setInterpolator(new LinearInterpolator()); oa3.setInterpolator(new LinearInterpolator()); // oa4.setInterpolator(new LinearInterpolator()); AnimatorSet as = new AnimatorSet(); as.playTogether(oa, oa3); as.start(); } }); } }
<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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="123" /> <ImageView android:id="@+id/imageView2" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:rotationX="-90" android:scaleType="fitXY" android:src="@drawable/tx" /> <ImageView android:id="@+id/imageView1" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/tx" /> <!-- <com.example.zdemo10.CubeView android:id="@+id/imageView3" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" /> --> </RelativeLayout>
============解决方案1============
============解决方案2============
标签:android blog http io ar java sp 2014 on
原文地址:http://www.cnblogs.com/liangxieliang56/p/4041979.html