2012-02-11 74 views
2

我在Android中使用MapView有一个奇怪的问题。Android MapView半屏白错误

它工作正常,直到我点击一个覆盖项目,然后回来。这张地图就像你在屏幕截图中看到的那样,一半白色,并且一直如此,直到我放大和缩小,一切都恢复正常。

有没有其他人看过这个?这可能是由于我的布局中的东西吗?

编辑
我发现这个问题与我有,我开始活动的MapView。不知何故,当我回来时,MapView的高度似乎被缓存了。试图无效和重新加载mapview,但没有任何工作。有人曾经看过这个错误吗?


MapView error

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

    <com.google.android.maps.MapView 
     android:id="@+id/MapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentBottom="true" 
     android:apiKey="xxx" 
     android:clickable="true" 
     android:enabled="true" 
     /> 

    <include 
     android:id="@+id/Progress" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     layout="@layout/progress" 
     android:visibility="gone" /> 

</RelativeLayout> 
+0

为什么你不仅alignParentBottom和alignParentTop属性设置:

做在的onResume以下解决了吗?它应该是全屏,没有他们设置。 – Demonick 2012-02-11 15:07:07

+0

是的,这是正确的,他们添加到测试....但得到相同的错误没有.... – oscar 2012-02-11 15:26:57

回答

3

的问题在某种程度上涉及到的MapView活动之间切换时重用一些关于布局。

LayoutParams layoutParams = mMapView.getLayoutParams(); 
mMapView.setLayoutParams(layoutParams);