Issue
I followed Hello Views, Google Map View and now I want to add a TextView under below the MapView. I have only changed the layout file main.xml and placed the MapView and the TextView in a vertical LinearLayout. My Eclipse is set to build this automatically, but when I run the application in the emulator, I can only see the MapView.
How can I add a TextView below a MapView?
Here is my layout main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="my key"
/>
<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="My TextView"
/>
</LinearLayout>
Solution
The issue you have is that you are using android:layout_height="fill_parent" in your MapView.
I don't get if you want:
- The
TextViewto be over the map - Shrink the
MapViewto leave space for theTextView
In the first case use a <RelativeLayout> instead of a <LinearLayout> and play with the android:layout_alignParentBottom="true" for the TextView.
In the second case, use android:layout_weight. I don't have eclipse opened but placing android:layout_weight="1"to the TextView should be enough.
Answered By - Macarse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.