Home > OS >  Problem with FragmentManager ADD Xamarin Android
Problem with FragmentManager ADD Xamarin Android

Time:03-11

Good morning, I'm using the google translator: I'm using FragmentManager ADD to navigate between fragments and save the state of the previous one so that when I press back it stays the same. But when selecting an item and adding the new fragment to the container, the layout is displayed without problems and completely covers the previous one, the problem is that the controls of the previous fragment are still active and when pressing click on different sides of the new fragment it calls procedures from the previous one. can someone tell me what is going on. I hope your help, thanking you in advance.

Android.Support.V4.App.Fragment fragment = new FamiliasProductosDetalleFragment();

        fragment.Arguments = Intent;

        FragmentManager.BeginTransaction()
             .Add(Resource.Id.content_frame, fragment)
             //.Replace(Resource.Id.content_frame,fragment)
             
             .AddToBackStack(null)
             .Commit();

CodePudding user response:

Add android:clickable="true" and android:focusable="true" on your root layout of the fragment that shows on top.

Since you are not replacing the content frame but just adding fragments on top, clicks will fall through and reach the fragments below.

  • Related