vivek tiwari vivek tiwari - 2 months ago 17
Android Question

Black line showing on map fragment in android

I am developing a fragment in Android. In my tab there are four fragments, of which one is a map fragment.

Using this map fragment:

<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" />


the task is done perfectly.

The problem is that when the user swipes, a black line is shown on the map fragment for 1 second. I've researched this online but couldn't find a way to prevent this? Why is this occurring and how can I fix it?

Answer

Was also facing this strange issue.Fixed it as follows by applying a transparent View over the mapview fragment seems to resolve the issue. Its a kind of hack.See if it works for you

<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>