Saturday, 6 October 2018

How to shrink a finishing activity to a rectangle

In my Android app, I have a floating Activity. It's started from outside my app using ActivityOptions.makeScaleUpAnimation to scale up from an "originating" rectangle. When my Activity finishes, I'd like it to do the reverse of that animation: i.e. it shrinks back to that rectangle as it fades out.

I know I can get the rectangle with getIntent().getSourceBounds(), and I'd hoped to be able to use overridePendingTransition() when finishing to achieve this effect, but overridePendingTransition() can only accept a fixed XML resource: there doesn't seem to be a way to make that animation depend on the source bounds. Is there something else I can use to achieve this effect?

My app is for API 11+, but as it's a cosmetic effect only, I'd be satisfied with a solution that depends on a later version.



from How to shrink a finishing activity to a rectangle

No comments:

Post a Comment