Wednesday, April 13, 2016

android explode transition doesn't explode GridView

Leave a Comment

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.

1 Answers

Answers 1

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.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment