1

I have implemented Google Maps with bottomsheet. However when I check the layout, the map is on the top of the screen, not occupying the whole width and height of the screen. I've tried many ways to fix this, but no luck.

enter image description here

enter image description here

Below is the layout code:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" >

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="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:layout_weight="1">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_gravity="fill_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill_vertical"
           >
            <fragment  xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:map="http://schemas.android.com/apk/res-auto"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/map"
                android:layout_gravity="fill_vertical"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.app.headcount.MapsActivity"
                />
        </RelativeLayout>
    </android.support.v4.widget.NestedScrollView>


    <include layout="@layout/test"
        android:id="@+id/design_bottom_sheet"/>



</android.support.design.widget.CoordinatorLayout>



</LinearLayout>

Could you please have a look at this and let me know where exactly is the issue? Thanks.

batman
  • 1,937
  • 2
  • 22
  • 41
Vyshakh
  • 632
  • 1
  • 11
  • 29
  • you want to show map on whole screen, but are not able to do the same. This is your question? – Rahul Sharma Sep 08 '16 at 08:01
  • @Vyshaks, you are using android:layout_weight="1" parameter along with android:layout_height="match_parent". Try to setpup height to 0dp, so android could calculate weight properly – Rafal Sep 08 '16 at 08:04
  • Why is the map fragment inside a scroll view ? – Mridul S Kumar Sep 08 '16 at 08:04
  • try this http://stackoverflow.com/questions/30806119/nestedscrollview-and-coordinatorlayout-issue-on-scrolling – amorenew Sep 08 '16 at 09:07

1 Answers1

6

try to use android:fillViewport="true"

Pratik
  • 456
  • 4
  • 18