2

I've extended ViewGroup to achieve something like a FlowLayout. I put my custom ViewGroup into a ScrollView, dynamically add a bunch of content and it doesn't scroll. The content that flows off the screen is not viewable.

What am I missing, how can I allow my ViewGroup to be compatible with ScrollView?

Kevin
  • 2,605
  • 2
  • 20
  • 15

1 Answers1

1

Your ViewGroup should have its height set to wrap_content to work properly. This also means you need to implement onMeasure() properly to give your ViewGroup an appropriate height.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • I'm trying to do something similar. I extended AdapterView to create a linear layout that is backed by data. When I put the widget inside of a scrollview, I cannot scroll to contents. The scrollview's height is only as big as the screen. What exactly does onMeasure do that will solve this problem? – murtuza Jul 13 '14 at 23:32