android-viewflow icon indicating copy to clipboard operation
android-viewflow copied to clipboard

Synchronized scroll in ListView

Open nfrancois opened this issue 13 years ago • 3 comments

I use ViewFlow in my application. This application is a Tv Guide which provides programs channel by channel. My ViewFlow contains ListView. When the user vertically scroll and go to side list, the list must have the same position :

Scroll

My principal problems was to know listVliew to set postion => I just add a getter and the syncrhonisation is manage in my actiivity.

But I think other people might be interested in this type of functionality. So I propose this feature to easily manage and automatically synchronizing the position of the ListView

II think creating a ListViewFlow which inherits which from ViewFlow

Are you interested ?

nfrancois avatar Aug 20 '11 19:08 nfrancois

This is actually the first time I see an app making use of ViewFlow, cool!

So, if I get it right. Your ListViewFlow would know that it contains a ListView and be able to synchronize the current vertical position to the other ListViews?

Sounds interesting but I'm thinking of a more general solution. I guess it would be possible to somehow add a custom "synchronizer" to the ViewFlow that would synchronize the views in any way the user want.

First of all, am I understanding your "problem" correctly?

pakerfeldt avatar Aug 20 '11 19:08 pakerfeldt

Not exactly, my problem was that I had to know mLoadedViews to set position on them when a ListView is scrolling. So, I add a getLoadedViews() method in ViewFlow. I do not have this scenario, but when a new ListView is created by ViewFlow, it means it's position have also to be set. But I think this solution is bad and can be improved.

Good idea to generalize, I'll think about it. In my case, I use OnScrollListener on all loadedView, and the position is set with 2 position indicator.

Have you idea of another synchronisation use case ? I just thinking about tabs : all views in horizontally scroll have the same tab selected.

nfrancois avatar Aug 21 '11 01:08 nfrancois

I don't really have a use case at all, other than the one you gave me. I just thinking that handling ListViews directly seems to be a bit to specialized. It should be possible to do a bit of abstraction to the problem to handle ListView as well as other types of use cases in the future. But then again, if we can't come up with another use case, maybe we're over-doing it. Let me think of this case a bit.

pakerfeldt avatar Aug 21 '11 09:08 pakerfeldt