Reputation: 16978
I have a fragment holding a Google Map object that I'm overlaying on top of other UI elements. I would like to make this fragment / map be transparent. Here is the element:
// the fragment in xml:
<fragment
android:id="@+id/map"
android:layout_width="140dp"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
class="com.google.android.gms.maps.MapFragment" >
</fragment>
// relevant Java code:
private GoogleMap map;
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
How can I make this map be transparent?
Upvotes: 2
Views: 2834
Reputation: 7120
The following code might work :
((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getView().setBackgroundResource(android.R.color.transparent)
You can even create a subclass of MapFragment
and override the OnCreateView()
method to set the background to be transparent.
Upvotes: 3