Chart using scrollview in Android

I want to draw a chart, and I use scrollview for this. my scrollview has a chart view. I noticed that scrollview onDraw calls onDraw of my chart view. Now I draw the entire graph on the canvas when calling the onDraw diagram. Also scrollview onDraw is called every time I view the view. Therefore, I end up drawing the entire graph several times. Is there a better way to achieve this

+3
source share
1 answer

Check out the View.getDrawingRect (direct) method. This will give you a scrollable area for drawing, so you can only draw parts that fall into that area.

+1
source

Source: https://habr.com/ru/post/1763778/


All Articles