Chintan Parmar
Chintan Parmar

Reputation: 2535

how to add a textview on mapview

I want to achieve something like this

this is my code. so i am using textview on mapview but i want transparent background around textview.. like it should look i like floating on mapview

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="7"
    android:orientation="vertical"
    android:weightSum="10">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="9"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:id="@+id/location_search"
        android:drawableRight="@drawable/ic_search"
        android:text="Search" />

    <com.google.android.gms.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:apiKey="AIzaSyD_UZKqkkSN9jQBb9vRk6P4Dz6KCTSUwzU">

    </com.google.android.gms.maps.MapView>


</LinearLayout>

Upvotes: 0

Views: 715

Answers (1)

Harsh Singhal
Harsh Singhal

Reputation: 567

Try this

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
        <TextView
            android:id="@+id/MyTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/hello"
            android:layout_alignParentBottom="true" />


        <com.google.android.maps.MapView
            android:id="@+id/map"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:apiKey="Your api key"
            android:enabled="true"
            android:clickable="true"
            android:layout_above="@+id/MyTextView"" />
 </RelativeLayout>

Upvotes: 2

Related Questions