Q:

Bottom of map fragment hidden under cardview

How can I get the map fragment I have in the first image to end where the card view starts, similar to how Strava does it in the second image.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="470dp"
tools:context="com.example.donal.navdrawer.Activities.MapsActivity"/>

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/maps_toolbar"
    android:layout_height="?attr/actionBarSize"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:background="?attr/colorPrimaryDark"
    android:layout_width="match_parent"

    />

<android.support.v7.widget.CardView
    android:id="@+id/card_view"
    android:layout_gravity="bottom"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:elevation="4dp">
</android.support.v7.widget.CardView>

</FrameLayout>

A:

If you define the layout_height of the card view, you can set the fragment height to 0dp and weight to 1. This will make sure the fragment will take all the available space left.

