我的活动有两个片段。第一个显示项目列表,第二个片段显示谷歌地图。当我点击google map选项卡时,Google Map可见,但只有一半区域可见。在上半部分地图可见,但是下半部分只有黑色部分。同时覆盖整个区域。当我触摸并飞到黑色区域时,我的地图也飞了起来。这意味着黑色区域也是地图的一部分。
并非所有手机都具有此问题。它仅在联想这样的少数手机中使用。我也只在一个活动中检查相同的地图实现(不使用片段),并且工作正常。
我还发现一件事,当我点击搜索框时,我的地图开始正确显示。
看看fragment_map.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="mypackageName.MyActivity">
<data>
<import type="android.view.View" />
<variable
name="viewModel"
type="mypackage.map.googlemap.GViewModel" />
</data>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/_600DP">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</layout>