2013-02-18 65 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