Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android explode transition doesn't explode GridView

I am trying to use explode exit transition on a grid view. However, the only thing that flies away radially is the floating button at the bottom of the screen. The GridView cells slide away as a single unit. How do I make these cells "explode"?

Here is my style.xml :

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorControlActivated">@color/colorAccent</item>
        <item name="colorControlHighlight">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <!-- Animation items -->
        <item name="android:windowActivityTransitions">true</item>
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowEnterTransition">@android:transition/fade</item>
        <item name="android:windowExitTransition">@android:transition/explode</item>
    </style>

</resources>

Here is the onCreate of the GridView activity that I am trying to explode :

protected void onCreate(Bundle savedInstanceState) {
        getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
        super.onCreate(savedInstanceState);
        getWindow().setExitTransition(new Explode());
        setContentView(R.layout.activity_main);

Alternately, If you know of examples that contain GridView explode transitions please feel free to post them.

like image 229
Flame of udun Avatar asked Apr 01 '16 18:04

Flame of udun


1 Answers

GridView works as one element, if you need every element of it to move in different directions - you need to configure animation for each element in dependence of it's position and launch all of them on exit before launching main exit animation.

like image 162
Wackaloon Avatar answered Oct 29 '22 18:10

Wackaloon