英文:
Why is my bottom navigation assuming my activity height instead of my FragmentContainerView's?
问题
My bottom navigation fragments are assuming my activity height instead of my FragmentContainerView's. I would like to know what the cause might be.
This is my bottomNavigation activity:
<?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/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_background"
tools:context=".ui.MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container_tab"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout="@layout/fragment_blank" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
My interface is looking something like this, in this particularly case I have a marginBottom of 32dp, but as you can see the view is assuming my activity constraints.
(I'm sorry before I forgot the print)
I expect the result to be something like this, that is my preview screen. I want the bottom of my fragment to be the top of the BottomNavigationView:
I don't know what code can help finding the solution for this issue but I can provide more code if needed
英文:
My bottom navigation fragments are assuming my activity height instead of my FragmentContainerView's. I would like to know what the cause might be.
This is my bottomNavigation activity:
<?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/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/default_background"
tools:context=".ui.MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container_tab"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout="@layout/fragment_blank" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
My interface is looking something like this, in this particularly case I have a marginBottom of 32dp, but as you can see the view is assuming my activity constraints.
(I'm sorry before I forgot the print)
I expect the result to be something like this, that is my preview screen. I want the bottom of my fragment to be the top of the BottomNavigationView:
I don't know what code can help finding the solution for this issue but I can provide more code if needed
答案1
得分: 0
我有两个不同的activity_main文件,其中一个文件在XML中有一个小错误。我不知道第二个activity是如何创建的。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论