2012-01-12 19 views
1

在我的活動頁面中,有一個佈局,其中包含頂部(listview1),列表視圖1下方的一個列表視圖,此視圖下方有一個textrview,第二個列表視圖放置。我想滾動完整的佈局。如何滾動包含2個列表視圖和android中的文本視圖的佈局

下面是示例代碼

<ScrollView 
    android:id="@+id/scrol1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/linearLayout1" 
    android:layout_marginTop="15dp" android:scrollbars="vertical" android:isScrollContainer="true"> 

    <RelativeLayout 
     android:id="@+id/relativeLayout4" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_below="@id/linearLayout1" 
     android:layout_marginTop="15dp" > 

     <ListView 
      android:id="@+id/lstMore" 
      android:layout_width="fill_parent" 
      android:layout_height="200dp" 
      android:divider="@null" 
      android:fadingEdge="none" 
      android:footerDividersEnabled="false" android:dividerHeight="0dp" android:cacheColorHint="#00000000"> 
     </ListView> 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Learn More" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="@color/black" 
      android:textStyle="bold" android:layout_below="@id/lstMore"/> 

     <ListView 
      android:id="@+id/lstMoreBottom" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:fadingEdge="none" android:layout_below="@id/textView2" android:divider="@null" android:dividerHeight="0dp" android:cacheColorHint="#00000000"> 
     </ListView> 

    </RelativeLayout> 
</ScrollView> 
+0

如果你給更多的信息會更容易兩種回答選項。你的代碼做什麼,會發生什麼,你看到什麼,等等...... – 2012-01-12 09:14:01

+0

通過放置上面的代碼,主滾動視圖不顯示。列表視圖1,列表視圖2滾動的都不起作用。 – 2012-01-12 09:18:44

回答

1

在我的經驗,這是不可能的滾動型多列表視圖。您嘗試將兩個可滾動窗口小部件放置在另一個可滾動窗口小部件中。

你應該做的是膨脹你的列表適配器的不同佈局,並有一個單獨的ListView沒有ScrollView。

+0

最後,我得到了解決方案。只需創建一個佈局,並在上面的code.And滾動視圖高度應該是一些像素,而不是wrapcontent /填充父母。通過這樣做,你會得到該佈局的完整滾動視圖。 – 2012-01-12 09:55:43

0

您可以在滾動條中使用多個listview。 使用nestedscrollbar在API 21真實,這above.Write在您的列表視圖:「機器人:nestedScrollingEnabled =‘真’」

它將工作definitly

相關問題