Surfaceview in listview scrolling issue

2019-09-08 08:09发布

问题:

i have a question for you.I'm developing a control based on a surfaceview which i called it "graph".In this control i draw a path (imagine a sinusoidal function).This control works fine.Now i want that my application would be able to show multiple instances of this graph control.I was thinking to use a listview control to contain them.I implemented it,but i have a problem when i scroll it.It seems that the adiacent graph items in the listview overlaps each other as it was non correctly refreshed.What do you think about the solution of using listview??Any solution or alternative to solve this issue?Thanks in advance.Paolo

回答1:

You should consider using just the View class for your control. SurfaceViews are for processor intensive rendering such as videos and 3D graphics, they are ideally fixed to a location or full screen and they run in their own thread which doesn't work well with the rest of the UI.