ConstraintLayout & BottomNavigationView,片段和控件出现在下方。 GoogleMaps v3 填充?
ConstraintLayout & BottomNavigationView, fragment and controls appear underneath. GoogleMaps v3 padding?
ConstraintLayout & BottomNavigationView、fragment 和控件出现在下方。 Google地图 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”。这行得通,但不适用于圆角,因为有 'empty space':
注意黑角。还有Google的一点版权。有没有办法告诉 GoogleMaps 片段(或其父 ConstraintLayout)到 'pad' 本身的底部,以便黑色圆角不是黑色,以及所需的 Goog 徽标和 ym 操作按钮没有隐藏在下面?
您应该调整地图的 padding 以将徽标向上移动,我认为这可以解决您的问题
Map padding allows you to reposition these elements if necessary. If
you display a custom UI at the bottom of the map, add padding to the
bottom of the map so that the logo and legal notices will always be
visible
ConstraintLayout & BottomNavigationView、fragment 和控件出现在下方。 Google地图 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”。这行得通,但不适用于圆角,因为有 'empty space':
注意黑角。还有Google的一点版权。有没有办法告诉 GoogleMaps 片段(或其父 ConstraintLayout)到 'pad' 本身的底部,以便黑色圆角不是黑色,以及所需的 Goog 徽标和 ym 操作按钮没有隐藏在下面?
您应该调整地图的 padding 以将徽标向上移动,我认为这可以解决您的问题
Map padding allows you to reposition these elements if necessary. If you display a custom UI at the bottom of the map, add padding to the bottom of the map so that the logo and legal notices will always be visible