I want to have a MapView taking all the space above a persistent bottom sheet (NestedScrollView) as I already have and you see on the image below.
For the MapView I'm using android:layout_height="238dp". I have tried to replace it for android:layout_height="match_parent" but then the height of the MapView was stretched taking up the entire screen. Here's is the code, as you see it on the image above.
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="beforeDescendants"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".SpotFormActivity"
tools:showIn="@layout/spot_form_master_layout">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/save_spot_form_basic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapview2"
android:layout_width="match_parent"
**android:layout_height="238dp"** />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/spot_form_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:paddingBottom="60dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
....
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
I don't want to use android:layout_height="238dp" because in devices with bigger screen the map height doesn't get automatically adjusted. Does anyone has a suggestion of a better way to do this?