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
android android-fragments


source to share


No one has answered this question yet

See similar questions:

1
Android snippets overlap previous view and button listeners

or similar:

937
findViewById in fragment
823
onActivityResult is not called on fragment
740
Dilemma: when to use Fragments vs Activities:
702
How to detect when a fragment becomes visible in the ViewPager
608
Using context in a fragment
603
Best practice for instantiating a new Android fragment
112
Android Fragment back stack issues
7
Fragments are superimposed on the back button
1
popBackStackImmediate does not show chunk when current chunk transaction is not added to the stack
0
Back button issue in android fragment



All Articles
Loading...
X
Show
Funny
Dev
Pics