ConstraintLayout & BottomNavigationView, fragment and controls appear underneath. GoogleMaps v3 padding?
ConstraintLayout & BottomNavigationView, fragment and controls appear underneath. GoogleMaps v3 padding?
My terminology may not be square here, which is likely why I can not find out what I am missing. Given my view 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>
My nav_host_fragment
may, depending on the user's action, have a fragment that is another ConstraintLayout
that has one or two action buttons that are constrained to the bottom, and I get this:
Doing what research I can, I saw two fixes. Either adding app:layout_constrainedHeight="true"
to the id/nav_host_fragment
, or changing the same fragment's layout_width
and layout_height
to "0dp". That works, but not with the rounded corners, as there's 'empty space':
Note the black corners. And Google's little copyright. Is there a way to tell the GoogleMaps fragment (or its parent ConstraintLayout) to 'pad' the bottom of itself, so that the black rounded corners aren't black, and the required Goog logo and ym action buttons aren't hidden underneath?
Answers 1
You should adjust the padding of the map to move the logo up and I think that solves your problem