Emil Adz Emil Adz - 6 months ago 39
Android Question

An invisible layout behind the fragment is getting clicked:

I have created several fragments and I add the first fragment the following way:

mainFragment = (MainFragment) MainFragment.create();
.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right)
.add(R.id.content, mainFragment, MAIN_FRAGMENT_TAG)

The second fragment is added this way:

getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left, R.anim.slide_in_left, R.anim.slide_out_right)
.add(R.id.content,VenueFragment.create(vid), "Venue Fragment")

Now as you see the hide method is not applied for this transaction, and the
is opened, the problem in this case is that while the
opened (and it's a full screen view) pressing on empty section of this fragment invokes calls of the
clickable views. How can I prevent this?

If I use the hide option then it's not happening but for some reason the animation for removing the
is going up and that makes a weird experience.


You need to make the root ViewGroup of VenueFragment clickable so it handles click events and they do not pass down (in the z-order sense) to the other Fragment.