1

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 2

2

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.

4
  • 1
    It 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.
    – AdamVe
    Commented 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 a ScrollView (item selection, etc.), so this is not a great solution. I think a better solution would be to copy the ListView code to your own class and remove all the stuff relating to scrolling.
    – Timmmm
    Commented Sep 18, 2012 at 9:46
1

Why do you still use the ListView? Create your own Layout for an item and load it several times (LayoutInflater, .addView(listItem)).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.