6

i have create custom list view using base adapter to dynamic row content.row content are created programmatically (check box,text view) they are include in layout. problem to scrolling time they are very slow because not use view holder. how can i use view holder this type of custom list view? any solution or suggestion?

following this list..

enter image description here

Ravi Parsania
  • 715
  • 7
  • 11

1 Answers1

0

ViewHolder is use in a list view when same view is repeated. Say there are total 6 items visible at a time in your activity. Then using viewholder pattern 6+2=8 views will be inflated at a time. one extra at the top and one extra at the bottom to give smooth scrolling effect. Now suppose scroll up operation is performed, and item at 8th position is visible, item at 0th position will be recycled and appended at the end of the list as the 9th item. if the views are not same this recycling can not be performed. check https://www.youtube.com/watch?v=wDBM6wVEO70

For your problem you can assume there is 5 maximum value possible then you can create adapter view using 10 dynamic views inside and set visibility as required.

Another optionis use LinearLayout and add each row dynamically but this won't give much optimization.

Pr38y
  • 1,565
  • 13
  • 21