I'm new in creating fragments and I have little problem with it. In second activity (in layout) I have widget
<fragment
...
android:name="path to my first fragment"
...
/>
I have three fragments to swap. I make it in this way
// get fragment manager and fragment transaction
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
// replace fragment on register form
transaction.replace(R.id.fragment, new Confirmation());
// commit transaction
transaction.commit();
and my fragments layout is wrap in two constraint layout like this
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
// additional widgets
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
</android.support.constraint.ConstraintLayout>
I found this solution on stack because I had visible remains of previous fragment. Now I have invisible reamins of previous fragment. Where I have a mistake? When I click on the position of button from previous fragment the button on this location is pressed