标签:etc end new div ext 改变 listen short des
public class MainActivity extends AppCompatActivity { private ImageView iv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); iv = findViewById(R.id.iv); iv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "你点不到我", Toast.LENGTH_SHORT).show(); } }); } public void click1(View view) { ObjectAnimator oa = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { oa = ObjectAnimator.ofFloat(iv, "rotation", 0, 90, 180, 270, 360); } oa.setDuration(2000); oa.start(); } public void click2(View view) { ObjectAnimator oa = ObjectAnimator.ofFloat(iv, "alpha", 0.0f, 1.0f); oa.setDuration(2000); oa.start(); } public void click3(View view) { ObjectAnimator oa = ObjectAnimator.ofFloat(iv, "translationX", 0.0f, 10.0f, 20.0f, 100.0f); oa.setDuration(2000); oa.start(); } public void click4(View view) { ObjectAnimator oa = ObjectAnimator.ofFloat(iv, "scaleX", 1.0f, 2.0f); oa.setDuration(2000); oa.start(); } public void click5(View view) { AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator oa1 = ObjectAnimator.ofFloat(iv, "rotation", 0, 90, 180, 270, 360); ObjectAnimator oa2 = ObjectAnimator.ofFloat(iv, "alpha", 0.0f, 1.0f); ObjectAnimator oa3 = ObjectAnimator.ofFloat(iv, "translationX", 0.0f, 10.0f, 20.0f, 100.0f); ObjectAnimator oa4 = ObjectAnimator.ofFloat(iv, "scaleX", 1.0f, 2.0f); animatorSet.playSequentially(oa1, oa2, oa3, oa4); animatorSet.setDuration(2000); animatorSet.setTarget(iv); animatorSet.start(); } }
标签:etc end new div ext 改变 listen short des
原文地址:https://www.cnblogs.com/nangongyibin/p/10257432.html