title: Fragment text showing inside BottomNavigationView
body: <p>I'm a beginner android developer and I've been trying to build a personal password manager. Currently I'm doing the front end part, the passwords list in particular.</p>
  <p>I'm trying to implement a bottom navigation bar which enables you to either see all the passwords, or only the saved(favorite) ones. The navigation bar looks fine and seems to work fine in terms of changing the fragments, but the problem is that the fragments seem to appear inside the navigation bar, instead of the FrameLayout above.</p>
  <p>For instance, if I tap on the &quot;saved&quot; button, the fragment with the string &quot;Saved&quot; on the center is supposed to show up above, but instead of this, the string shows up inside the bottom navigation bar.
  Also, if I happen to set a background color to any one of the fragments, the color completely cover the navigation bar. I don't know what's wrong.</p>
  <p>Here's the main activity of the password list:</p>
  <pre class="lang-kotlin prettyprint-override"><code>package com.example.pwman
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import androidx.fragment.app.Fragment
  import com.example.pwman.databinding.ActivityMainBinding
  import com.google.android.material.bottomnavigation.BottomNavigationView
  
  class pwList : AppCompatActivity() {
  
      private val search = search()
      private val saved = saved()
  
      override fun onCreate(savedInstanceState: Bundle?) {
  
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_pw_list)
          replaceFragment(search)
  
          val bottom_navigation = findViewById&lt;BottomNavigationView&gt;(R.id.bottomNavigationView)
  
          bottom_navigation.setOnItemSelectedListener {
              when(it.itemId) {
                  R.id.saved -&gt; replaceFragment(saved)
                  R.id.search -&gt; replaceFragment(search)
              }
              true
          }
  
      }
  
      private fun replaceFragment(fragment : Fragment) {
          if (fragment !=null) {
              val transaction = supportFragmentManager.beginTransaction()
              transaction.replace(R.id.bottomNavigationView, fragment)
              transaction.commit()
          }
      }
  }
  </code></pre>
  <p>And this is the xml file of the main activity along with the xml files of the fragments:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.pwList&quot;&gt;
  
      &lt;com.google.android.material.bottomnavigation.BottomNavigationView
          android:id=&quot;@+id/bottomNavigationView&quot;
          app:menu=&quot;@menu/menu&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          android:background=&quot;@color/white&quot;
          app:itemTextColor=&quot;@color/black&quot;/&gt;
  
  
      &lt;FrameLayout
          android:id=&quot;@+id/frameLayout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;0dp&quot;
          app:layout_constraintBottom_toTopOf=&quot;@+id/bottomNavigationView&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
      &lt;/FrameLayout&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.saved&quot;
      &gt;
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:text=&quot;Saved&quot;
          android:textSize=&quot;25sp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.search&quot;
      &gt;
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;TextView
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:text=&quot;Search&quot;
          android:textSize=&quot;25sp&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;  /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>