Android Animation when launching a new application

I am creating a new launcher for myself. Now, when I launch applications from my main activity, she has this default animation, which makes my panel launch and a new application pops up on top of it. Instead, I want to attach my own animation. It is preferable that the default material tangency animation is displayed.

Things I've tried so far:

You need to use Theme.AppCompat theme (or descendant) with this action on Android

http://tips.androidhive.info/2015/09/android-how-to-apply-material-design-theme/

<style name="swLaunch" parent="swLaunch.Base"> <item name="android:windowContentTransitions">true</item> <item name="android:windowAllowEnterTransitionOverlap">true</item> <item name="android:windowAllowReturnTransitionOverlap">true</item> <item name="android:windowSharedElementEnterTransition">@android:transition/explode</item> <item name="android:windowSharedElementExitTransition">@android:transition/explode</item> <item name="android:windowEnterAnimation">@android:transition/explode</item> <item name="android:windowExitAnimation">@android:transition/explode</item> <item name="android:taskToFrontEnterAnimation">@android:transition/explode</item> <item name="android:taskToBackEnterAnimation">@android:transition/explode</item> <item name="android:taskToFrontExitAnimation">@android:transition/explode</item> <item name="android:taskToBackExitAnimation">@android:transition/explode</item> <item name="android:inAnimation">@android:transition/explode</item> <item name="android:layoutAnimation">@android:transition/explode</item> <item name="android:windowShowAnimation">@android:transition/explode</item> <item name="android:activityOpenEnterAnimation">@android:transition/explode</item> <item name="android:fragmentOpenEnterAnimation">@android:transition/explode</item> </style> 

this is how i run my applications:

 Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.google.android.gm"); if (launchIntent != null) { startActivity(launchIntent); } 
+6
source share
1 answer

Activity start animation:

 int left = 0, top = 0; int width = v.getMeasuredWidth(), height = v.getMeasuredHeight(); ActivityOptions opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height); startActivity(i, opts.toBundle()); 

where i is Intent and v is View

to quicken the return to the main screen (by pressing the "Home" or "Back" button)

 @Override public void onResume() { super.onResume(); // override default transition animation overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } 
+5
source

Source: https://habr.com/ru/post/1011937/


All Articles