我有带有 Bottom_navigation 的 main_layout 和带有其他一些组件的片段。左侧片段处于纵向方向,此处的 NavigationBottomView 看起来不错,但在方向设置为横向的右侧片段上,底部还有一个填充。问题是如何在横向模式下删除导航视图底部的填充?第一张截图:
\n\n现在代码:
\nmain_activity.xml
\n<?xml version="1.0" encoding="utf-8"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"\n xmlns:app="http://schemas.android.com/apk/res-auto"\n xmlns:tools="http://schemas.android.com/tools"\n android:id="@+id/main_layout"\n android:layout_width="match_parent"\n android:layout_height="match_parent"\n android:background="@color/colorBackground"\n android:filterTouchesWhenObscured="true"\n tools:context="pl.anwim.zcspa.activities.MainActivity">\n\n <ProgressBar\n android:id="@+id/progress"\n style="?android:attr/progressBarStyleLarge"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:indeterminate="true"\n android:visibility="gone"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toEndOf="parent"\n app:layout_constraintStart_toStartOf="parent"\n app:layout_constraintTop_toTopOf="parent" />\n\n <androidx.fragment.app.FragmentContainerView\n android:id="@+id/nav_host_fragment"\n android:name="androidx.navigation.fragment.NavHostFragment"\n android:layout_width="0dp"\n android:layout_height="0dp"\n app:defaultNavHost="true"\n app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"\n app:layout_constraintLeft_toLeftOf="parent"\n app:layout_constraintRight_toRightOf="parent"\n app:layout_constraintTop_toBottomOf="@id/toolbar_include"\n app:navGraph="@navigation/nav_graph" />\n\n <com.google.android.material.bottomnavigation.BottomNavigationView\n android:id="@+id/bottom_navigation"\n android:layout_width="0dp"\n android:layout_height="wrap_content"\n android:background="@color/colorWhite"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toEndOf="parent"\n app:layout_constraintStart_toStartOf="parent"\n app:layout_constraintTop_toBottomOf="@id/nav_host_fragment"\n app:menu="@menu/role_dispatcher_menu" />\n\n <include\n android:id="@+id/toolbar_include"\n layout="@layout/common_toolbar_hamburger"\n app:layout_constraintBottom_toTopOf="@+id/nav_host_fragment"\n app:layout_constraintLeft_toLeftOf="parent"\n app:layout_constraintRight_toRightOf="parent"\n app:layout_constraintTop_toTopOf="parent" />\n</androidx.constraintlayout.widget.ConstraintLayout>\n
Run Code Online (Sandbox Code Playgroud)\n(左)对手站列表片段.xml
\n<?xml version="1.0" encoding="utf-8"?>\n<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"\n xmlns:app="http://schemas.android.com/apk/res-auto"\n xmlns:tools="http://schemas.android.com/tools"\n android:layout_width="match_parent"\n android:layout_height="match_parent">\n\n …
Run Code Online (Sandbox Code Playgroud)