Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a textview on top of a Map Fragment

I want to create this layout, but I am unable to set the Text Image on the fragment. My requirement to set the layout is as I show in the attached image.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayoutFragment"
    android:layout_width="match_parent"
    android:layout_height="fill_parent" >

     <!-- ListRow Left sied Thumbnail image -->

    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:background="@drawable/image_bg"
        android:padding="3dip" 
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/list_image"
            android:layout_width="50dip"
            android:layout_height="50dip"
            android:src="@drawable/atm" />
    </LinearLayout>

    <!-- Name of ATM -->

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="#040404"
        android:textSize="15dip"
        android:textStyle="bold"
        android:typeface="sans" />

    <!-- Location -->

    <TextView
        android:id="@+id/location"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/title"
        android:layout_marginTop="1dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="#343434"
        android:textSize="10dip" />


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

</RelativeLayout>

enter image description here

like image 627
N Sharma Avatar asked Jul 02 '13 17:07

N Sharma


1 Answers

Put map fragment as first one (order matters!) in your RelativeLayout (so it will be on "bottom"). Then (at least I'd do that for simplicity) group all items you want in your overlay in another container (i.e. LinearLayout or RelativeLayout), position that container on top of your view and you are mostly done.

like image 149
Marcin Orlowski Avatar answered Sep 19 '22 21:09

Marcin Orlowski