I have a map view for android maps api v2 in an activity that uses this sliding menu https://github.com/iPaulPro/SlidingMenu. The sliding menu works great except for on the map page. There is a black view covering the sliding menu that is the exact size of the map. This is an example with the map height set at 100dp to outline what I mean.
If I touch that view it will go away. How would I get rid of it or make it transparent? I've tried the requestTransparentRegion() trick. No dice there.
Found this stack overflow post ViewPager with Google Maps API v2: mysterious black view and used this class in place of the normal map fragment.
package com.myapp.gms.maps;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import com.google.android.gms.maps.SupportMapFragment;
/**
* @author btate
*/
public class TransparentSupportMapFragment extends SupportMapFragment {
public TransparentSupportMapFragment() {}
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup view,
Bundle savedInstance) {
View layout = super.onCreateView(inflater, view, savedInstance);
FrameLayout frameLayout = new FrameLayout(getActivity());
frameLayout.setBackgroundColor(
getResources().getColor(android.R.color.transparent));
((ViewGroup) layout).addView(frameLayout,
new ViewGroup.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT
)
);
return layout;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With