create 2 vertical scrollbars in layout in android
In my layout there is one Listview开发者_StackOverflow社区 and multiple controls. If I create scroll view
listview scroll does not work. If I remove scroll view listview scrolling is works.
how to get both scrolls working?
Thanks in advance, Durai
If you really need both (ScrollView and ListView), try to reduce the width of the ListView, so that you have some free space on the left or right of the ListView, where the user can touch and scroll the ScrollView below it. Otherwise the ListView will always receive the scroll events.
I mean it like this:
-----------------------
I I I
I I I
I I I
I ListView I I
I I I
I I I
I I I
-----------------------
<---- ScrollView ---->
You cannot get both to scroll. You can define weight for your Listview
while wrapping its content.
Otherwise if other controls take too much of the screen space then, instead of using a Listview
, Use a Linearlayout
to hold your items with a ScrollView
as the parent.
ListView comes with its own scroll and extends till the length of the list. You cannot club scroll and listview together.
精彩评论