属性动画

xiaoxiao2025-10-19  5

public class HomeActivity extends AppCompatActivity { private TextView txtCircle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); txtCircle = findViewById(R.id.txt_circle); //横向 ObjectAnimator ObjectAnimator txanimator = ObjectAnimator.ofFloat(txtCircle, "translationX", 0, 670); // 纵向 ObjectAnimator ObjectAnimator tyanimator = ObjectAnimator.ofFloat(txtCircle, "translationY", 0, 1120); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(tyanimator).with(txanimator); animatorSet.setDuration(3000); animatorSet.start(); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { Intent intent = new Intent(HomeActivity.this, GroupActivity.class); startActivity(intent); } }); } }

注:圆球是textview 设置shape形状 ,textview的宽高多少,shape的弧度就是多少

转载请注明原文地址: https://www.6miu.com/read-5038219.html

最新回复(0)