I have the following question: I have a difficult layout that contain ListView. I need disable scrolling ability for ListView, because it's container (root Layout) have had ScrollView already, and I don't need a scrolls for ListView. I disable scrolls by android:scrollbars="none", but abilitity for scrolling would stay. I need that if ListView has 10 items that all items will be shown. How can I do it?
2 Answers
Can't you just use a LinearLayout
with 10 elements instead of the ListView
? It is not a good idea to have a ScrollView
in another ScrollView
.
-
1It is good solution, but I need to divide items by "divider" like divider of ListView, but I don't know how to use it on LinearLayout. Commented Nov 14, 2011 at 21:30
-
Divider height can be done by margin or padding (top, bottom). Self divider can be replaced by an empty view with the drawable set on it? You could have this divider view between all the elements.– AdamVeCommented Nov 14, 2011 at 21:40
-
Indeed, a ListView inside a ScrollView is a bad idea Commented Nov 14, 2011 at 21:57
-
A
ListView
has many more features than aScrollView
(item selection, etc.), so this is not a great solution. I think a better solution would be to copy theListView
code to your own class and remove all the stuff relating to scrolling.– TimmmmCommented Sep 18, 2012 at 9:46
Why do you still use the ListView? Create your own Layout for an item and load it several times (LayoutInflater
, .addView(listItem)
).