2011-03-06 123 views
0

我花了很多時間尋找解決方案,但找不到任何解決方案。我幾乎可以肯定,對於你們中的一些人來說,這看起來像一個虛擬的問題,但我真的被困在這裏。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在屏幕上重疊。

我想您的幫助,以瞭解如何滾動型添加到佈局,使我得到一個滾動的溶液中存在: 1/5行的ListView 2 /的MapView

如果屏幕小,用戶可以滾動到MapView部分。

謝謝任何​​需要幾分鐘幫助我的人。迄今爲止,我所有的測試都失敗了。

亞當。

+0

在我嘗試重現此問題之前的快速問題:您是否嘗試用ScrollView替換RelativeLayout?當MapView開始重疊ListView時嗎? – Turnsole

+0

你好繡球。是的,我基本上試圖做到這一點,並嘗試了我可以在網上分析的各種解決方案(LinearLayout> Scroll> Relative)。我也試圖改變佈局類型,但沒有成功。目前,我將採用下面由Ravi提供的解決方法。感謝您的關注。 –

回答

0

嘗試以下解決方法:ListView in ScrollView potential workaround

基本上嘗試把你的地圖到ListView中的footerview,以防止它們重疊。

+0

謝謝拉維。它運作良好,給我我需要的東西。 –

+0

很高興能提供幫助:-) –

+0

Ravi:最後一個問題涉及您提供給我的解決方法。我怎樣才能設置頁腳的高度?假設我希望它具有200dip的高度?再次感謝。 –