0

OP와 마찬가지로 (ViewPager with Google Maps API v2: mysterious black view), 블랙은 ListView와 통합 될 때 부분적으로 만이 아니라 모든지도를 지배합니다. 나는이 주제가이 부분을 창조하는데 어떤 역할을한다고 생각하지 않는다. 그 OP의 답변을 통합하려 할 때, 전체 조각이 검은 색 공백으로 변했습니다.Google지도 v2 셜록과리스트 뷰가있는 검은 색 화면

누군가 내 조각을보고이 오류를 알아내는 데 도움이 되겠습니까?

감사합니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:map="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<RelativeLayout 
    android:id="@+id/map" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    class="com.google.android.gms.maps.SupportMapFragment" /> 

<ListView 
    android:id="@+id/map_frag_view" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" /> 

</LinearLayout> 

내 조각은 다음과 같습니다

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ 
    //Checks if GooglePlayService is On--> Should take this out once first check forces user to have it 
    boolean ifPlay = MainActivity.getInstance().checkIfGooglePlay(); 

    if(ifPlay) { 
     if (mapFragView != null) { 
      ViewGroup parent = (ViewGroup) mapFragView.getParent(); 
      if (parent != null) 
       parent.removeView(mapFragView); 
     } 
     try { 
      mapFragView = inflater.inflate(R.layout.maptab, null, false); 
     } catch (InflateException e) { 
      /* map is already there, just return view as it is */ 
     } 
    } 

    //Creating MapFragment from SharedPreferences recently stored information 
    SharedPreferences tmpManager = MainActivity.getInstance().prefs; 

    String recWordAssoc = tmpManager.getString("wordAssociations", "default"); 


    //Building list 
    String[] theList = buildList(recWordAssoc); 
    assocListView = (ListView) mapFragView.findViewById(R.id.map_frag_view); 

    if(theList==null) { 
     theList = new String[0]; 
    } 

    mapAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, theList); 
    assocListView.setAdapter(mapAdapter); 
    ((BaseAdapter) assocListView.getAdapter()).notifyDataSetChanged(); 



    if(mapFragView != null) { 
     setMapTransparent((ViewGroup)mapFragView); 
     return mapFragView; 
    } 

    ((ViewGroup) assocListView.getParent()).removeView(assocListView); 


    container.addView(assocListView); 
    container.addView(mapFragView); 

    setMapTransparent(container); 
    return container; 
} 
+0

검은 색 표면보기를 만들기 위해이 대체 클래스를 사용할 수 있습니다 : http://code.google.com/p/gmaps-api-issues/issues/detail? id = 4659 그리고이 문제에 대해 투표하십시오. 더 빨리 해결 될 것입니다. –

+0

안녕하세요 @StephaneMathis, 나는 ObservableScrollView를 사용하려고하지 않으므로 Greg의 솔루션이 적용되지 않는다고 생각합니다. 감사합니다. – NumenorForLife

+0

표면을 투명하게 만들려고 했습니까? –

답변

1

시도 대신 기본 블랙의 thesurfaceview 투명하게 만들 수 있습니다. : SupportMapFragment 클래스에서 :

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(Color.TRANSPARENT); 
     } 
    } 
} 
+0

안녕하세요 @ 스 테판, 아직 솔루션을 구현하는 데 어려움이 있습니다. 아마도 코드의 잘못된 부분에 배치했을 것입니다. 위에 붙여 넣었고 제공 할 수있는 추가 권장 사항에 대해 매우 감사드립니다! – NumenorForLife

+0

제대로 사용하고있는 것 같습니다. 문제가 무엇인지 모르겠습니다. 샘플 프로젝트에서 좀 더 구체적인 코드로 문제를 격리 할 수 ​​있다면 Gmaps API 포럼에 게시해야합니다. –

+0

또한 이것을 살펴보면, 가능한 다른 2 가지 해결책 (zOrderOnTop 또는 Handler)이 있습니다. –