I\'m trying the jetpack navigation and can\'t show the navigation back button when I move to a new fragment.
NavigationActivity.kt
class NavActivity : Ap
Edit: Your DetailFragment
contains the line
DataBindingUtil.setContentView(requireActivity(),
R.layout.fragment_detail)
which is resetting the content of your Activity to only be your fragment_detail
layout, wiping out the NavHostFragment and everything else.
You should be using DataBindingUtil.bind
instead.
Original answer (you should still do this, but the above answer is actually what solves the problem)
Your ConstraintLayout
is missing quite a few constraints (your views should be a vertical chain, where every app:layout_constraintTop_toBottomOf
has an alternative app:layout_constraintBottom_toTopOf
on the other element, etc.).
Since you have a single set of three vertically aligned items, you don't need a ConstraintLayout
- just a LinearLayout
is enough: