Similar to the OP here (ViewPager with Google Maps API v2: mysterious black view), black dominates not just part but all of my Map when incorporated with the ListView. I do not believe the theme plays any part in creating this. When I attempted to incorporate that OP's answer, my entire fragment transformed into a black void.
Would someone mind looking at my Fragment and help me figure out this error?
Thanks!
<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>
My Fragment is:
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;
}