我想在mapview / mapfragment顶部放置一个imageview。我已经成功放置了imageview,但是在屏幕的左右两侧有一个缝隙。我希望imageview完全覆盖mapview。所使用图像的分辨率为720x1280。

布局:

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

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:src="@drawable/sphere_background" />

</RelativeLayout>


输出:



请告诉我imageview从左到右完全覆盖地图的方法。

最佳答案

在android:scaleType =“ fitXY”中添加ImageView。例如。

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    android:scaleType="fitXY"
    android:src="@drawable/sphere_background" />

10-07 20:02
查看更多