I've to make a horizontal list view inside a vertical list view. Both list views can have any number of elements and both needs to be scrollable.
How will I achieve this because I've read that android doesn't support list view hierarchy.
Thanks !
Shrink wrapping the content of the scroll view is significantly more expensive than expanding to the maximum allowed size because the content can expand and contract during scrolling, which means the size of the scroll view needs to be recomputed whenever the scroll position changes.
You might want to create a list that scrolls horizontally rather than vertically. The ListView widget supports horizontal lists. Use the standard ListView constructor, passing in a horizontal scrollDirection , which overrides the default vertical direction.
To Achieve this this, You have to do the following::
Hence this will let you scroll vertically in the Screen as well as Horizontally in each ListView.
for eg.
<ScrollView>
<LinearLayout..... //this a vertically oriented layout
>
<ListView/>
.
.//This listViews Are Horizontal
.
<ListView>
</Linearlayout>
</ScrollView>
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With