这是我的xml文件,然后是anim文件夹.当我运行应用程序时,会显示解析错误.
shake.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
< translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromXDelta="0%"
android:interpolator="@anim/cycle_7"
android:toXDelta="5%" />
</set>
Run Code Online (Sandbox Code Playgroud)
cycle_7.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
< cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="7" />
</set>
Run Code Online (Sandbox Code Playgroud)
IT人员永远欢迎您在这里找到您正在寻找的完整代码.
<translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0%" android:toXDelta="5%" android:duration="1000" android:interpolator="@anim/cycle_7" />
Run Code Online (Sandbox Code Playgroud)
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="7" />
Run Code Online (Sandbox Code Playgroud)
private void showError() {
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
mEditText.startAnimation(shake);
}
Run Code Online (Sandbox Code Playgroud)
<,translate如果你复制了代码.看看这个.<set> 不是必需的,因为我已经使用上面的代码运行演示它工作正常.谢谢.愿这对你有所帮助.