2012-08-09 44 views
0

使用https://github.com/vieux/Android-Horizontal-ListView使用開源的Android Horizo​​ntalListView,與layout_height =「WRAP_CONTENT」

意想不到的效果所以我想和多個水平列表視圖的屏幕。這是我的XML文件。

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#fff" 
    > 

    <com.devsmart.android.ui.HorizontalListView 
    android:id="@+id/listView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#fff" 
    /> 

    <com.devsmart.android.ui.HorizontalListView 
    android:id="@+id/listView2" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#fff" 
    /> 
</LinearLayout> 

唯一的問題是,當我做高度的wrap_content時,它將高度註冊爲整個屏幕。我進行了測試,以確保我的第二個列表視圖是通過將第一個列表視圖高度更改爲設置的像素量並且都在那裏。

我在github上讀到了這個,這是一個已知的問題,但它說它是固定的......我想我錯過了什麼?

如果有人有任何經驗,我會很感激!

+0

你有沒有項目從你的帖子在github上的鏈接?現在不工作,我想要它。你可以發佈嗎? – Lunatikul 2013-08-21 13:11:39

+1

我相信是這樣的:https://github.com/dinocore1/DevsmartLib-Android – 2013-09-09 05:42:08

回答

0

試試這個。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#fff" 
android:orientation="vertical" > 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#fff" 
    android:orientation="vertical" > 

    <com.devsmart.android.ui.HorizontalListView 
     android:id="@+id/listView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="#fff" /> 

    <com.devsmart.android.ui.HorizontalListView 
     android:id="@+id/listView2" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="#fff" /> 
</LinearLayout> 

如果你沒有得到解決,然後重播。

相關問題