Question

I have extended LinearLayout (vertical) to create a custom compound component. This in turn contains two children:

  • one custom view that is drawn directly onto the view canvas.
  • one HorizontalScrollView->LinearView(Horizontal)->Multiple custom views.

I would now like to redraw the custom view to match the visible contents of the scroll view. The reason for this is that the long array of custom components in the scroll view are mainly static and suitable to be drawn ahead of time, while the top view is supposed to be highly dynamic and relate to whatever things are visible in the scroll view.

I hope I made the problem/idea somewhat clear. I am not att all confident this is the best approach, and I'd enjoy hearing any suggestions on alternative solutions or perhaps some idea on how to trigger a redraw-event everytime the scroll position changes in the HorizontalScrollView.

Thank!

Was it helpful?

Solution

You can have your activity listen to the scroll view adapter. in the adapter when ever the scroll position changes you execute the delegate in the Activity. That way the activity can update the rest of the views upon scroll view change.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top