Để đạt được điều này này, bạn phải làm như sau ::
- Tạo một scrollview Vertical có đơn LinearLayout.
- Bây giờ Tạo ListViews ngang bên trong LinearLayout này như trong Ví dụ dưới đây:
Do đó điều này sẽ cho phép bạn cuộn theo chiều dọc trong Screen cũng như ngang trong mỗi ListView.
ví dụ:
<ScrollView>
<LinearLayout..... //this a vertically oriented layout
>
<ListView/>
.
.//This listViews Are Horizontal
.
<ListView>
</Linearlayout>
</ScrollView>
Edit: Thêm động ListView với LinearLayout.
LinearLayout ll=(LinearLayout)findViewById(R.id.id_given_in_the_XML_file);
ListView lv=new ListView(Activityname.this);
.
.
.
Do All ListView Processing Here
.
.
.
lv.setAdapater(adapter);
ll.addView(lv);
Nguồn
2012-07-30 12:30:03
Scrollviews không thể lồng nhau. [Xem thêm tại đây] [1]. [1]: http://stackoverflow.com/questions/4490821/scrollview-inside-scrollview – Snicolas