2013-05-16 2 views
1

지도 조각을 ScrollView의 자식 인 LinearLayout 내에 배치했습니다. 아래로 스크롤하면지도가 나타나면지도에 검은 색 패치가 남습니다. ICS viz 이전의 장치에서이 문제를 직면하고 있습니다. 생강 빵. 비슷한 문제가있는 사람이 있습니까? enter image description hereandroid google map v2 이전 ICS에서 발생

+1

가능한 내부

map = ((MyMapFragment) getSupportFragmentManager() .findFragmentById(R.id.mapView)).getMap(); 

중복 http://stackoverflow.com/questions/13793483/google-maps- android-api-v2-blacking-out-of-part-of-layout? rq = 1 – chopchop

+1

및 this : http://stackoverflow.com/questio ns/16017498/slidingmenu-shows-blsck-used-with-map-api-v2 –

답변

1

나는 해결책을 얻었다 !!

클래스 MyMapFragment

import android.os.Bundle; 
import android.view.LayoutInflater; 
import android.view.SurfaceView; 
import android.view.View; 
import android.view.ViewGroup; 

import com.google.android.gms.maps.SupportMapFragment; 

public class MyMapFragment extends SupportMapFragment { 

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
      Bundle savedInstanceState) { 
     View view = super.onCreateView(inflater, container, savedInstanceState); 
     setMapTransparent((ViewGroup) view); 
     return view; 
    }; 

    private void setMapTransparent(ViewGroup group) { 
     int childCount = group.getChildCount(); 
     for (int i = 0; i < childCount; i++) { 
      View child = group.getChildAt(i); 
      if (child instanceof ViewGroup) { 
       setMapTransparent((ViewGroup) child); 
      } else if (child instanceof SurfaceView) { 
       child.setBackgroundColor(0x00000000); 
      } 
     } 
    } 
} 

초기화 GoogleMap으로 만들기 XML

<LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="250dp" 
      android:layout_marginBottom="15dp" 
      android:background="@drawable/mapouter" > 

      <fragment 
       xmlns:map="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/mapView" 
       android:name="com.example.MyMapFragment" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 
     </LinearLayout>