谷歌地图在我的布局中裁剪

时间:2017-01-14 08:38:05

标签: android google-maps

以下是我的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:background="#ffffff"
        android:id="@+id/promotion_image"
        android:scaleType="fitXY"/>
    <View
        android:id="@+id/grayline"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/darker_gray"
        android:layout_below="@+id/promotion_image"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="company name"
        android:id="@+id/company_name"
        android:layout_below="@id/grayline"
        android:typeface="monospace"
        android:textSize="20sp"
        android:textColor="#000000"
        android:padding="10dp"
        android:background="#ffffff"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Title"
        android:id="@+id/title"
        android:layout_below="@id/company_name"
        android:typeface="monospace"
        android:textSize="15sp"
        android:textColor="#000000"

        android:padding="10dp"
        android:background="@drawable/rounded_corner"/>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Description"
        android:id="@+id/sales_description"
        android:layout_below="@id/title"
        android:textSize="10sp"
        android:textColor="#000000"
        android:padding="10dp"
        android:background="#ffffff"/>
    <View
        android:id="@+id/grayline2"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#d3d3d3"
        android:layout_below="@+id/sales_description"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Small Text"
        android:id="@+id/promotional_period"
        android:layout_below="@id/grayline2"
        android:textSize="15sp"
        android:textColor="#000000"
        android:background="#ffffff"
        android:padding="10dp"
        android:layout_marginBottom="10dp"
        android:drawableLeft="@drawable/blue_clock"
        android:drawablePadding="10dp" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Location"
        android:id="@+id/locationText"
        android:layout_below="@id/promotional_period"
        android:textStyle="bold"
        android:textSize="15sp"
        android:textColor="#000000"
        android:padding="10dp"
        android:background="#ffffff"
        android:drawableLeft="@drawable/blue_map_marker"
        android:drawablePadding="10dp"/>
    <View
        android:id="@+id/grayline3"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#d3d3d3"
        android:layout_below="@+id/locationText"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:id="@+id/sales_location"
        android:layout_below="@id/grayline3"
        android:textSize="15sp"
        android:textColor="#000000"
        android:padding="10dp"
        android:background="#ffffff"/>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map_framecontainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_below="@id/sales_location">

        <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:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context="com.example.user.mycouponcodes.RetrieveIndividualWarehouseSales"
            map:cameraZoom="10"/>
        </FrameLayout>



</RelativeLayout>
    </ScrollView>

一切正常,但谷歌地图被裁剪如下: Screenshot here

如何让谷歌地图尺寸更大?即使我删除了FrameLayout,它也显示了相同的结果。

1 个答案:

答案 0 :(得分:0)

通过硬编码高度来解决它

android:layout_height="200dp"

不确定这种方式是否通常是这样做但是有效。