我正在使用SupportMapFragment在ScrollView中顯示靜態地圖。我不喜歡移動/縮放地圖,只是顯示位置在哪裏。Android v2 MapFragment在Scrollview中滾動時發抖
當我向下滾動/向上滾動地圖時,它感覺很不穩定。我的問題是,怎麼可能消除這種滯後,或者如何使用靜態版本的v2 api地圖。
這是我的佈局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin_half"
android:background="@color/white"
android:orientation="vertical" >
...
<fragment
android:id="@+id/fragmentMap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignParentLeft="true"
android:layout_below="@id/viewDivider"
android:layout_margin="@dimen/margin_half"
/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_alignBottom="@id/fragmentMap"
android:layout_alignLeft="@id/fragmentMap"
android:layout_alignRight="@id/fragmentMap"
android:layout_alignTop="@id/fragmentMap"
android:background="@android:color/transparent" />
...
</RelativeLayout>
這是不是真的與MapFragment in ScrollView,即使我用這種伎倆來刪除舊設備上的黑色剪裁,因爲你可以用透明的視圖中看到。
我也被禁用所有的手勢和地圖的點擊功能查看:
getMap().getUiSettings().setAllGesturesEnabled(false);
getMap().getUiSettings().setZoomControlsEnabled(false);
getMap().getUiSettings().setMyLocationButtonEnabled(false);
...
mapView.setClickable(false);
mapView.setFocusable(false);
mapView.setDuplicateParentStateEnabled(false);
不幸的是,它不能解決垂直滾動滯後問題,但它是透明覆蓋層更美觀的解決方案。謝謝。 – joecks
關於您的問題我目前沒有看到解決方案,我一直使用谷歌地圖全屏在活動 –
這是個壞消息。也許我會再次使用API v1。 – joecks