Buttons interfere with overlapping fragments

I have an application where one snippet is the "main menu" in which a submenu (another snippet) can be opened from which a button is clicked. Each submenu completely covers the main menu. When the button is clicked in the main menu, I add the transaction to the back stack, so that when the user clicks the back button, it will bring him back to the main menu:

MyFragment frag = new MyFragment ();
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.main_layout, frag, "NextFrag");
transaction.addToBackStack("NextFrag");
transaction.commit();

      

I noticed that the buttons from my "main menu" snippet are still active from the second snippet, although you cannot see them. I came across this post which suggested to make the layout of each fragment by clicking

android:clickable="true"

      

It works, but I don't understand why and feel like I am missing something.

+3


source to share





All Articles