problem in displaying text view above a map
I have to display three text views above a map in one of my activities and I have the following xml...but I don't know why I see no text view only my map.
Here is my xml file:
<?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"
android:id="@+id/first"
android:background="#0000ff">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:id="@+id/bar"
android:layout_below="@id/first"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/prod1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dip"
android:textSize="12px"
android:text="Sursa"
/>
<TextView android:id="@+id/prod2"
android:layout_width="wrap_content"
android:layout_height="wrap开发者_Go百科_content"
android:gravity="center_horizontal"
android:paddingLeft="83dip"
android:textSize="12px"
android:text="destinatie"
/>
<TextView android:id="@+id/prod3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingLeft="85dip"
android:textSize="12px"
android:text="data"
/>
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0egkyrbiooKAfYyj43YB6wW1cmlG-TiIILXjpBg"
/>
</RelativeLayout>
That's because you set the height of your MapView to 'fill_parent'. Set to some fixed height just for debugging purposes and you should see your text views - they may not appear above the map, as you want, because you've set the LinearLayout to go below the RelativeLayout and it contains the MapView. Remove the code from the LinearLayout:
android:layout_below="@id/first"
and add this to the MapView element:
android:layout_below="@id/bar"
You can also use MERGE tags as the root for your layout, which allows for multiple layouts to be layered over each other.
精彩评论