0

I have spent a lot of time looking for a solution, but could not find any. I'm almost certain that it will look like a dummy question to some of you, but I'm really stuck here.

I'm trying to have a MapActivity with a 5 rows ListView at the top of the screen, followed by a MapView. The ListView will always be 5 rows big.

I'm using this layout, which gave me the closest of the result I want :

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content">
    <ListView xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/infoListe"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:cacheColorHint="#00000000"/>
    <com.google.android.maps.MapView
          android:id="@+id/mapview"
          android:layout_width="wrap_content"
          android:layout_height="200dip"
          android:enabled="true"
          android:clickable="true"
          android:apiKey="<KEY_OMITTED_HERE>"
          android:layout_alignParentBottom="true"/>
    </RelativeLayout>

I get the result I want on recent hi-res devices, but on lower resolution devices, the ListView and the MapView do overlap on the screen.

I would like your help to understand how to add a ScrollView to the layout so that I get a scrollable solution presenting : 1/ the 5 rows ListView 2/ the MapView

If the screen is to small, the user can scroll to get to the MapView section.

Thank you to anyone who will take a few minutes to help me. All my tests have failed so far.

Adam.

Adam Dulson
  • 283
  • 5
  • 16
  • Quick question before I try reproducing this: have you tried replacing that RelativeLayout with a ScrollView? Is that when the MapView starts to overlap the ListView? – Turnsole Mar 06 '11 at 19:31
  • Hello Hydrangea. Yes I basically tried to do that, and also tried the various solutions I could parse on the web (LinearLayout > Scroll > Relative). I've also tried to change the layout types with no success. For the moment, I'll go with the workaround provided by Ravi below. Thanks for your interest. – Adam Dulson Mar 07 '11 at 06:47

1 Answers1

0

Try this workaround : ListView in ScrollView potential workaround

Basically try putting your map into the footerview of the listview to prevent them from overlapping.

Community
  • 1
  • 1
Ravi Vyas
  • 12,212
  • 6
  • 31
  • 47
  • Ravi : 1 last question refering to the workaround that you provided to me. How can I set the height of the footer? Let's say that I want it to have a height of 200dip ? Thanks again. – Adam Dulson Mar 08 '11 at 06:50
  • You can set the hight of the footer layout , in your case the hight of the mapview – Ravi Vyas Mar 08 '11 at 08:59
  • Ravi : I don't seem to be able to set the height, although I m using the following code to describe my mapview : ` ` – Adam Dulson Mar 08 '11 at 13:50