I have created several fragments and I add the first fragment the following way:
mainFragment = (MainFragment) MainFragment.create(); 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, mainFragment, MAIN_FRAGMENT_TAG) .commit();
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) //.hide(mainFragment) .add(R.id.content,VenueFragment.create(vid), "Venue Fragment") .addToBackStack(null) .commit(); setDrawerIndicatorEnabled(false);
Now as you see the hide method is not applied for this transaction, and the VenueFragment
is opened, the problem in this case is that while the VenueFragment
opened (and it's a full screen view) pressing on empty section of this fragment invokes calls of the MainFragment
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 MainFragment
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With