2013-02-18 59 views
1

我正在开发Android中的一个片段。在我的标签中有四个片段,其中一个是地图片段。在android上显示地图片段的黑线

使用该地图片段:

<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/map" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      class="com.google.android.gms.maps.SupportMapFragment" /> 

任务完全可以做到的。

问题是,当用户滑动时,地图片段上会显示一条黑线1秒。我在网上研究过这个,但是找不到预防这种情况的方法?为什么会发生这种情况,我该如何解决?

回答

10

也面临着这个奇怪的问题。通过在mapview片段上应用透明视图来修复它如下,似乎解决了这个问题。它是一种破解。看看它是否适合你

<RelativeLayout 
      android:id="@+id/relativeLayout1" 
      android:layout_width="match_parent" 
      android:layout_height="300dp" > 

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

      <View 
       android:id="@+id/imageView123" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@android:color/transparent" />   
    </RelativeLayout> 
+0

非常感谢很多人。你解决了我的问题。 – 2013-02-18 17:45:36

+0

非常感谢。有用。 – Neela 2013-06-03 06:20:07

+0

作品!顺便说一句,你是怎么想到它会起作用的? :) – sha256 2013-08-19 19:44:25