MapView not supporting layout_height

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

MapView not supporting layout_height

Postby rrgoove » Thu Apr 28, 2011 3:41 am

Hello, I'm building a layout that contains two buttons and a MapView. The buttons should be placed above and below the MapView. I've tried several combinations of layouts (Relative, Linear, Frame...), but the MapView does not support the layout_height=wrap_content unless I use a specific height like layout_height="200dp".

The tope button is displayed, but the bottom button is not. Below is my test XML file.

Any suggestions?

<?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"
>

<Button
android:id="@+id/btn1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button1"
android:background="#FF0000" />

<com.google.android.maps.MapView
android:id="@+id/map1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:apiKey="my map key (removed for example)"
/>

<Button
android:id="@+id/btn2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button2"
android:background="#00FF00" />

</LinearLayout>
rrgoove
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Apr 28, 2011 3:30 am

Top

Re: MapView not supporting layout_height

Postby mrco » Thu May 05, 2011 3:10 pm

Try to add this line:

<com.google.android.maps.MapView
android:layout_weight="1"
android:id="@+id/map1"
android:layout_width="fill_parent"
mrco
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Fri Jan 15, 2010 11:31 am
Location: 2V Software

Top

Return to Map Problems

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests