Omar Omar - 1 year ago 148
Android Question

HorizontalScrollView custom adapter?

I'm trying to make a

widget using
, So inside the
I add
s, and the problem is that I'm going to add 600+ images!

Can I make some kind of a custom adapter in order to override the
method and utilize
in order to make the app smoother and avoid adding 600+ views at the same time?

Answer Source

HorizontalScrollView can contain only one View, so you have to draw that whole View anytime you are drawing any part of it. This could, however, be worked around by

  1. extending ViewGroup as child of your HorizontalScrollView
  2. using your custom adapter in that ViewGroup and call getView() and recycle on your own, drawing only Views that are currently visible in your HorizontalScrollView

But this would take a lot if your time. I'd at least try something like HorizontalListView first. A how-to of that specific class can be found here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download