简体   繁体   中英

How to make list view scroll above top item and under last item

I need to implement list view that must show selected item in the center of list view.

Is it possible?

The problem is that list view forbid scrolling before top item and after last item. The only workaround here I found is to add several dummy header and bottom items and use setSelectionFromTop() method for right positioning.

Is there any other better way?

Thanks

You could use a circular ListView Check this thread on how to implement it

and use smoothScrollToPosition to bring your particular view to the center.

You shouldn't need to add multiple dummy list items. Just extend your Adapter and use a single blank dummy list item that you can programmatically adjust the size of based on the screen resolution of the device.

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