【发布时间】:2021-03-24 20:32:37
【问题描述】:
ConstraintLayout & BottomNavigationView,fragment 和控件出现在下方。 GoogleMaps v3 填充?
我的术语在这里可能不正确,这可能是我找不到我遗漏的内容的原因。 鉴于我对 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"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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="?attr/colorPrimary"
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="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/mobile_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
根据用户的操作,我的nav_host_fragment 可能有一个片段,它是另一个ConstraintLayout,它有一个或两个操作按钮被限制在底部,我明白了:
尽我所能进行研究,我看到了两个修复。将app:layout_constrainedHeight="true" 添加到id/nav_host_fragment,或将同一片段的layout_width 和layout_height 更改为“0dp”。这有效,但不适用于圆角,因为有“空白空间”:
注意黑角。还有谷歌的一点版权。有没有办法告诉 GoogleMaps 片段(或其父 ConstraintLayout)“填充”自身的底部,以便黑色圆角不是黑色,并且所需的 Goog 徽标和 ym 操作按钮不会隐藏在下面?
【问题讨论】:
标签: android google-maps android-constraintlayout material-components-android