I want to replace an old Fragment with a new Fragment, but i still get the buttons of the old Fragment that is still visible in the ne
put your next fragment UI elements in Card View. define a LinearLayout or other view groups as root and inside this root create a Card view and put your other elements in Card View . when you inflate it in Card View then the hole of new fragment inflate on the previous fragment.
......... your UI Elements .......
//, for example, define other LinearLayout inside the Card View
and put other elements inside it like TextView, Button and
so on...