<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="750"> <alpha android:fromAlpha="-0.20" android:toAlpha="1.0" android:duration="750"> </alpha></translate></set>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="750"> </translate></set>
package com.myapp; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; import android.app.Activity; import android.content.Intent; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Button1 final Button btn1 = (Button) findViewById(R.id.button1); // Perform action on click btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Open Form 2 new Handler().postDelayed(new Runnable() { public void run() { Intent newActivity = new Intent(MainActivity.this,ActivityForm2.class); startActivity(newActivity); finish(); overridePendingTransition(R.layout.mainfadein, R.layout.mainfadeout); } }, 1500); } }); } }
package com.myapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; public class ActivityForm2 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_form2); // Button1 final Button btn1 = (Button) findViewById(R.id.button1); // Perform action on click btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Open Form 3 new Handler().postDelayed(new Runnable() { public void run() { Intent newActivity = new Intent(ActivityForm2.this,ActivityForm3.class); startActivity(newActivity); finish(); overridePendingTransition(R.layout.mainfadein, R.layout.mainfadeout); } }, 1500); } }); } }
package com.myapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; public class ActivityForm3 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_form3); // Button1 final Button btn1 = (Button) findViewById(R.id.button1); // Perform action on click btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Back to Form 1 new Handler().postDelayed(new Runnable() { public void run() { Intent newActivity = new Intent(ActivityForm3.this,MainActivity.class); startActivity(newActivity); finish(); overridePendingTransition(R.layout.mainfadein, R.layout.mainfadeout); } }, 1500); } }); } }
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท