0

Hi I have a listview with 11 elements. sometimes I want the user can scoll upto maximum 9th element and sometimes i want to scroll upto 5th element. So can we set maximum scroll position in listview depending on condition?

Thanks Sunil

Sunil Kumar Sahoo
  • 49,865
  • 50
  • 172
  • 240

1 Answers1

1

Why not create an OnTouchListener and attach it to your ListView. In the onTouch event, check whether the maximum position has been exceeded, and call scrollTo to prevent the scroll from going past the maximum.

Alternatively, you could simply modify your ListAdapter to sometimes only list 9 or 5 elements when you want to limit the scroll.

Mark Allison
  • 21,534
  • 8
  • 43
  • 45