Android - ScrollView问题

时间:2011-03-06 19:21:24

标签: android scrollview

我花了很多时间寻找解决方案,但找不到任何解决方案。我几乎可以肯定,对你们中的某些人来说,这看起来像是一个虚假的问题,但我真的被困在这里。

我正在尝试在屏幕顶部放置一个带有5行ListView的MapActivity,然后是MapView。 ListView总是5行大。

我正在使用这种布局,这给了我最接近的结果:

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

我在最近的高分辨率设备上得到了我想要的结果,但在低分辨率设备上,ListView和MapView在屏幕上重叠。

我希望您能帮助我们了解如何将ScrollView添加到布局中,以便我获得一个可滚动的解决方案: 1/5行ListView 2 / MapView

如果屏幕很小,用户可以滚动到达MapView部分。

感谢任何需要几分钟时间帮助我的人。到目前为止,我所有的测试都失败了。

亚当。

1 个答案:

答案 0 :(得分:0)

尝试此解决方法:ListView in ScrollView potential workaround

基本上尝试将地图放入列表视图的页脚视图中,以防止它们重叠。