4

When I replace a Fragment with another Fragment, the replaced Fragment is still behind the new Fragment and the clickable events in the replaced Fragment are still working. I can't see any of the old Fragment, but the touch events are still working.

I tried even clearing the backstack before replacing but to no avail.

Why is this happening?

getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
getSupportFragmentManager().beginTransaction().replace(R.id.container, 
    MatchedFragment.newInstance(matchHistoryId, matchUserId, matchAvatar), "matchedFragment").commit();
The Nomad
  • 7,155
  • 14
  • 65
  • 100

1 Answers1

18

Set clickable of your current layout to true

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true" />

Fragment over another fragment issue

Community
  • 1
  • 1
SteD
  • 13,909
  • 12
  • 65
  • 76