ScrollView with static views

0

I'm trying to develop a graph that has two types of views, Views A and Views B . When doing horizontal scroll only Views B must be moved, but when doing vertical scroll all views must be moved, including the A views .

This is the basic approach but until now I have not found a way to achieve it. I have used different types of approaches, from lists (RecyclerView and ListView) in which I could move the items horizontally, to designs with several synchronized HorizontalScrollView that allowed me to move all Views B . But all these approaches have been very complex to implement the logic of my application or with poor performance due to the number of embedded views.

So far, the best approach I had was that of a ConstrintLayout in which I added the views dynamically. All the Views B were restricted (anchored) to a guide , which allowed me to move all B views when moving the guide (the guide moved it by modifying its margin). Also the ConstraintLayout was embedded in a 'ScrollView which allowed me to move it vertically without problems.

So far so good, while testing it in an emulator on the PC horizontal and vertical scroll worked wonderfully. But when I tested it on a physical device it showed performance problems, the horizontal scroll was slow and with many cuts, but the vertical worked great, so I think the problem is trying to move too many elements at the same time.

I have also thought about drawing the whole graphic in a Canvas or a SurfaceView , but I'm not sure if those are the right approaches or if there are better ones. So my question is simple:

Do you know what would be the best approach to developing this graph?

Any suggestions are welcome.

    
asked by David Minaya 11.07.2018 в 01:03
source

0 answers