left_in <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="-100%" android:toXDelta="0" android:duration="500"> </translate> left_out <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0" android:toXDelta="-100%" android:duration="500"> </translate> right_in <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="100%" android:toXDelta="0" android:duration="500"> </translate> right_out <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="0" android:toXDelta="100%" android:duration="500"> </translate>
public class SetupGuide2Activity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_setup_guide2); } public void next(View v) { startActivity(new Intent(this, SetupGuide3Activity.class)); overridePendingTransition(R.anim.right_in, R.anim.left_out); } public void pre(View v) { finish(); overridePendingTransition(R.anim.left_in, R.anim.right_out); } }
原文:https://www.cnblogs.com/znsongshu/p/9365363.html