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.

Sign up to request clarification or add additional context in comments.

4 Comments

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.
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.
Indeed, a ListView inside a ScrollView is a bad idea
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.
1

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.