I have a fragment with a swipe-refresh layout containing a Recycler view and I added custom transitions and associated it with the fragment through frag.setEnterTransition()
before the I started the fragment's transaction. But however it doesn't transition at all. It just abruptly appears, just as it would without transitions.
To narrow-down where I could have gone wrong, I redid it with a LinearLayout
instead of swipeRefreshLayout
and the fragment transitions as expected.
This is my xml for the fragment.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout_inapp_list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rv_inapp_messages_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="@dimen/transactions_space_small"/>
<include layout="@layout/widget_empty_screen"/>
</FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>
This is how the fragment gets transacted.
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
fragment.setEnterTransition(bottomGravitySlide);
fragment.setExitTransition(fadeOut);
fragment.setAllowEnterTransitionOverlap(false);
fragment.setAllowReturnTransitionOverlap(false);
}
fragmentTransaction.replace(R.id.vg_full_container, fragment, TAG_INTRODUCTION).commitAllowingStateLoss();
And I'm using API23, so the API check shouldn't be the problem.
Where am I going wrong? What should I do if I want to have swipeRefreshLayout and still be able to transition?