Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I start new activity as an expended circle from center [duplicate]

I want to start a new activity from center of screen as an expended circle so the activity will be revealed as a circle like this.

example

Here is my current code anim.xml

<set xmlns:android="http://schemas.android.com/apk/res/android" >
<scale
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="200"
    android:fromXScale="0"
    android:fromYScale="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="1"
    android:toYScale="1" >
</scale>

animback.xml

    <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="1.0"
        android:toYScale="1.0" >
    </scale>
</set>

Calling the animation

overridePendingTransition(R.anim.anim,R.anim.animback);

The current code just zooms in the new activity but I want the activity to be revealed from center as a circle.

like image 480
Rosenpin Avatar asked Aug 21 '14 06:08

Rosenpin


People also ask

How do you create a circular reveal effect when starting a new activity?

createCircularReveal() method enables you to animate a clipping circle to reveal or hide a view. To reveal a previously invisible view using this effect: // previously invisible view View myView = findViewById(R. id.

How do you start an activity?

To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent. # Start the activity connect to the # specified class Intent i = new Intent(this, ActivityTwo.


1 Answers

I'm not sure if it is possible with transition animations.

Maybe it is possible to achieve desired result in following way:

  • Make a screenshot of Activity A before transition
  • Transit to activity B without animation
  • Overlay Activity A screenshot on Activity B
  • Animate the overlay (apply custom drawing)

or

  • Make an activity B transparent
  • Transit to Activity B without animation
  • Animate Activity B layout (apply custom drawing)

See also: DevBytes: Custom Activity Animations

like image 148
vokilam Avatar answered Oct 28 '22 20:10

vokilam