1. 动画: 颤动
1.1 anim/shake.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXDelta="0"
    android:interpolator="@anim/cycle_7"
    android:toXDelta="10" />

1.2 anim/cycle_7
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
    android:cycles="7" />

1.3 实现颤动效果
TextView tv = findViewById(R.id.tv);
Animation shake = AnimationUtils.loadAnimation(this,  R.anim.shake);
tv.startAnimation(shake);

2. 界面之间 Activity 切换动画效果: 水平移动效果(其他动画类似)
2.2 anim/translate_in.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="100%p"
    android:toXDelta="0"
    android:duration="400">
</translate>

2.3 anim/translate_out.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromXDelta="0"
    android:toXDelta="-100%p"
    android:duration="400">
</translate>

2.4 界面切换效果实现
Intent intent = new Intent(this, MyActivity.class);
finish();
startActivity(intent);
//activity 切换效果
overridePendingTransition(R.anim.translate_in, R.anim.translate_out);
 




相关文章:

  • 2021-09-08
  • 2022-01-18
  • 2021-10-18
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-04
  • 2022-01-12
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案