Zeeshan Ahmed
Zeeshan Ahmed

Reputation: 1187

Show a transparent layout over the Google maps fragment android

I want to show a transparent layout over the map fragment which include one image and one text line as a hint over the map. When a user will click over that layout, it will become invisible and the map will be displayed. Don't know to show a transparent one over the map. please help.

My Map layout is :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="@dimen/ten_dp" >

<fragment
    android:id="@+id/map_address"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

Upvotes: 1

Views: 3585

Answers (1)

marshallino16
marshallino16

Reputation: 2671

You just have to set transparent color to the background value

background:"@android:color/transparent"

And in your case, just add a layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:padding="@dimen/ten_dp" >

<fragment
    android:id="@+id/map_address"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

<RelativeLayout 
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="@android:color/transparent">
       <TextView/>
      <ImageView/>

</RelativeLayout> 

</RelativeLayout>

Upvotes: 6

Related Questions