0

In my app there are two tabs, one tab include map and other one shows map. When I am switching the tab, map screen becomes black for a second until maps doesnt load and then shows the map.I have checked solutions on stackoverflow but doent help in my case.Please suggest.

mainlayout.xml

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

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:paddingBottom="61dp">
    </android.support.v4.view.ViewPager>

    <!-- hack to fix ugly black artefact with maps v2 -->

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent" >
      </FrameLayout> 

  <com.agile.pbc.common.NonSwipeableViewPager
        android:id="@+id/bottomPager"
        android:layout_width="match_parent"
        android:layout_height="62dp"
        android:layout_gravity="bottom|center_vertical"
        android:background="@android:color/transparent" >
    </com.agile.pbc.common.NonSwipeableViewPager>

   <com.agile.pbc.common.ViewPagerOutline
        android:layout_width="match_parent"
        android:layout_height="62dp"
        android:layout_gravity="bottom|center_vertical"/> 

</FrameLayout>

maplayout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    tools:context=".LocatorMainActivity$DummySectionFragment" >
   <fragment
        android:id="@+id/map"
        class="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="fill_parent"
        android:layout_height="match_parent" />

</RelativeLayout>
gIrL
  • 139
  • 4
  • 15
  • A black screen is shown may be because of your slow internet connection. – GrIsHu Dec 04 '13 at 06:16
  • Please refer these: http://stackoverflow.com/questions/14978841/android-google-map-v2-fragment-black-bg-issue http://stackoverflow.com/questions/13837697/viewpager-with-google-maps-api-v2-mysterious-black-view http://stackoverflow.com/questions/19271450/android-actionbar-turns-black-when-loading-fragment-with-google-map-for-the-firs – Sercan Ozdemir Dec 04 '13 at 06:18
  • @SercanOzdemir I have checked above solutions but doesnt worked. – gIrL Dec 04 '13 at 06:33
  • @GrIsHu yes may be but i want to resolve this issue and not able to find the solutions ;(. – gIrL Dec 04 '13 at 06:35
  • AFAIK there is no solution if its occurring because of the internet connection. – GrIsHu Dec 04 '13 at 06:38
  • @GrIsHu No its not happening because of slow internet connection. – gIrL Dec 04 '13 at 07:08
  • I am able to take snapshot of map and stored on sdcard. but how and when to set that image to background of fragment until map loads in app. Please suggest. thanks – gIrL Dec 06 '13 at 06:05

0 Answers0