-
-
Save codingwithsara/09e7253dca4402156e2c99e40d9ebc3b to your computer and use it in GitHub Desktop.
Activity Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jp.codeforfun.activityanimation; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
public class MainActivity extends AppCompatActivity implements View.OnClickListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// クリックリスナーをセット | |
findViewById(R.id.normalBtn).setOnClickListener(this); | |
findViewById(R.id.fadeBtn).setOnClickListener(this); | |
findViewById(R.id.slideBtn).setOnClickListener(this); | |
} | |
@Override | |
public void onClick(View v) { | |
startActivity(new Intent(this, SecondActivity.class)); | |
switch (v.getId()) { | |
case R.id.fadeBtn: | |
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |
break; | |
case R.id.slideBtn: | |
overridePendingTransition( | |
android.R.anim.slide_in_left, android.R.anim.slide_out_right); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment