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.