How can I start an event from a location on the screen, for example, on the main screen or in recent applications?

I want to create a “maximizing” effect from the dialog to my full activity, so I want the opening animation to display activity expanding from the field to the full size.

The stock launcher did this because Jelly Bean (clicking on the application shortcut will zoom in on the application from this icon location, and the Recent Apps menu did this with ICS.

+7
android animation
source share
2 answers

It revealed!

Bundle options = ActivityOptionsCompat.makeScaleUpAnimation( findViewById(android.R.id.content), findViewById(android.R.id.content).getLeft(), findViewById(android.R.id.content).getTop(), findViewById(android.R.id.content).getWidth(), findViewById(android.R.id.content).getHeight()).toBundle(); startActivity(intent, options); 

It works only with API 16 and higher, so check it and use the old old startActivity for older versions.

+2
source share

The maximum from the lower left corner will be something like this.

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:duration="2000"> <scale android:fromXScale="0" android:toXScale="1" android:fromYScale="0" android:toYScale="1" android:pivotX="0%" android:pivotY="100%"/> <translate android:fromYDelta="100%p" android:toYDelta="0%p"/> </set> 
0
source share

All Articles