android explode transition doesn't explode GridView
Asked Answered
D

2

6

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.

Devilment answered 1/4, 2016 at 18:50 Comment(1)
take a look at this link: github.com/lgvalle/Material-Animations..Zaid
P
3

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.

Prostate answered 13/4, 2016 at 12:16 Comment(0)
L
0

Place of GridView you can use recyclerview in this you can achieve both the functionality gridview and list view and ease to translate view.

http://www.androidhive.info/2016/01/android-working-with-recycler-view/

http://developer.android.com/reference/android/support/v7/widget/RecyclerView.html

Lao answered 14/4, 2016 at 5:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.