Я использую автоматически сгенерированную активность нижней панели навигации android студией. Но мои макеты выглядят не очень хорошо. вот что я создал: ![enter image description here](https://i.stack.imgur.com/nascj.png)
но вот как это выглядит при запуске: ![enter image description here](https://i.stack.imgur.com/ytrB2.png)
Также мой макет основной деятельности: ![enter image description here](https://i.stack.imgur.com/9FegX.png)
основная деятельность xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
---------------------------------------------
Fragment xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fancy="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment">
<ProgressBar
android:id="@+id/nextWordPb"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="381dp"
android:layout_height="32dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.466"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/timerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:text="time"
android:textColor="@android:color/holo_purple"
android:textSize="25sp"
android:textStyle="italic"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/nextWordPb"
app:layout_constraintEnd_toEndOf="@+id/nextWordPb"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="@+id/nextWordPb" />
<FrameLayout
android:id="@+id/fancyframe"
android:layout_width="412dp"
android:layout_height="181dp"
android:layout_marginTop="24dp"
android:background="@drawable/gradient"
android:elevation="3dp"
app:layout_constraintBottom_toTopOf="@+id/fancyframeexam"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" >
<TextView
android:id="@+id/startbtn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="frame1"
android:textColor="@android:color/white"
android:textSize="33sp" />
</FrameLayout>
<FrameLayout
android:id="@+id/fancyframeexam"
android:layout_width="415dp"
android:layout_height="182dp"
android:layout_marginBottom="300dp"
android:background="@drawable/gradient2"
android:elevation="3dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/startexam"
android:layout_width="414dp"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="frame2"
android:textColor="@android:color/white"
android:textSize="33sp" />
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Я пытался создать новый проект, но получил тот же результат. Расположение выглядит хорошо, когда нет фрагмента. но они такие, когда я использую фрагменты.