, , , , , , , .
git
https://github.com/lgvalle/Material-Animations
,
here is the operation code you should write
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
new Handler().postDelayed(new Runnable() {
public void run() {
Intent mainIntent = new Intent(SplashScreen.this,
ConnectedActivity.class);
mainIntent.putExtra("id", "1");
startActivity(mainIntent);
SplashScreen.this.finish();
overridePendingTransition(R.anim.mainfadein,R.anim.splashfadeout);
}
}, SPLASH_DISPLAY_TIME);
}
Add two files to the res / anim folder.
slide_in.xml
<?xml version="1.0" encoding="utf-8"?>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromXDelta="100%p"
android:toXDelta="0%p">
</translate>
slide_out.xml
<?xml version="1.0" encoding="utf-8"?>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromXDelta="0%p"
android:toXDelta="-100%p">
</translate>
I hope this solves your requests.
Navin source
share