我希望点击ImageView活动从右到左加载动画。如果我在开发人员模式下将动画比例设置为1x,但我想在开发人员模式下没有设置动画,那么它可以正常工作。
Animation.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="500"/>
Animation2.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="-50%p"
android:duration="500"/>
imageview点击代码文件如下:
imgswipeleft.setOnTouchListener(new OnSwipeTouchListener(MainActivity.this) {
public void onSwipeTop() {
Toast.makeText(MainActivity.this, "top", Toast.LENGTH_SHORT).show();
}
public void onSwipeRight() {
Toast.makeText(MainActivity.this, "RIGHT", Toast.LENGTH_SHORT).show();
}
public void onSwipeLeft() {
Intent i = new Intent(MainActivity.this, EpubReaderActivity.class);
Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.animation,R.anim.animation2).toBundle();
startActivity(i,bndlanimation);
overridePendingTransition(R.anim.animation,R.anim.animation2);
}
public void onSwipeBottom() {
Toast.makeText(MainActivity.this, "bottom", Toast.LENGTH_SHORT).show();
}
});
请有人帮我解决这个问题。提前谢谢。