Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android google map v2 fragment black bg issue

Tags:

android

How to make the black background transparent in google map v2 while scrolling?

<RelativeLayout
                    android:id="@+id/relativeLayout1"
                    android:layout_width="match_parent"
                    android:layout_height="134dp"
                    android:layout_alignParentTop="true"
                    android:layout_gravity="center" >

                    <fragment
                        xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/map"
                        android:layout_width="fill_parent"
                        android:layout_height="434dp"
                        android:layout_marginBottom="-150dp"
                        android:layout_marginLeft="3dp"
                        android:layout_marginRight="3dp"
                        android:layout_marginTop="-150dp"                       
                        class="com.google.android.gms.maps.SupportMapFragment"
                        android:cacheColorHint="@color/transparent"
                        android:clickable="true" />

                    <FrameLayout
                        android:id="@+id/fram_lay"
                        android:layout_width="match_parent"
                        android:layout_height="172dp" >

                        <android.support.v4.view.ViewPager
                            android:id="@+id/fragment_container"
                            android:layout_width="fill_parent"
                            android:layout_height="134dp" >
                        </android.support.v4.view.ViewPager>

                        <FrameLayout
                            android:id="@+id/fram_lay2"
                            android:layout_width="match_parent"
                            android:layout_height="334dp"
                            android:layout_marginTop="-100dp"                            
                            android:background="@android:color/transparent"
                            android:cacheColorHint="#00000000" />
                    </FrameLayout>
                </RelativeLayout>

I have given transparent frame over map but still it is flickering. please somebody give me a solution thank you

like image 579
Sreedhu Madhu Avatar asked Feb 20 '13 11:02

Sreedhu Madhu


1 Answers

The transparent frame over the MapView will only solve the black hole problem, the flicker will still happen each time the map re-loads it's resources i.e. when OnCreateView() is called.

Try the solution posted here with adding a MapView in the main Activity and then hiding it once initialized.

like image 171
Medo Avatar answered Sep 24 '22 03:09

Medo