简体   繁体   中英

How to disable scrolling for ListView on Android?

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?

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM