Created
April 30, 2014 19:21
-
-
Save arianimartins/de78dbf214341ba4e31d to your computer and use it in GitHub Desktop.
Efeito Fade-in e Fade-out na transição de telas ou fragments
This file contains hidden or 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
//Em Activity | |
Intent i = new Intent(MainActivity.this, Destino.java); | |
startActivity(i); | |
overridePendingTransition(R.anim.fadein, R.anim.fadeout); | |
// Em fragments (provavelmente já possúi um código parecido com este) | |
FragmentManager fragmentManager = getSupportFragmentManager(); | |
FragmentTransaction transaction = fragmentManager.beginTransaction(); | |
transaction.setCustomAnimations(R.anim.fadein, R.anim.fadeout); //animação aqui | |
transaction.commit(); |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<alpha xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/accelerate_interpolator" | |
android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="500" /> |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<alpha xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/accelerate_interpolator" | |
android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="500" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment