pankajagarwal
pankajagarwal

Reputation: 13582

Chart using scrollview in Android

I want to draw a chart and I'm using a scrollview to do so. my scrollview holds the chart view. What I've observed is that the scrollview's onDraw calls the onDraw of my chart view. Now I draw the entire chart on the canvas when the onDraw of chart view is called. Also scrollview's onDraw is called everytime I scroll the view. So I end up drawing the entire chart multiple times. Is there any better way to achieve what this

Upvotes: 3

Views: 1032

Answers (1)

Thorstenvv
Thorstenvv

Reputation: 5396

Check out the View.getDrawingRect(rect) method. This will give you the scrolled area to draw, so you can draw just the parts that fall into this area.

Upvotes: 1

Related Questions