views:

104

answers:

1

I currently have one Scrollview which contains a table layout and one list in my activity. Now my problem is that I wanted to move both of them(Scrollview and list) together and with proper synchronization... So if scrollview is being scrolled then listview should also scroll with the same distance, and vice versa...

Thanks in advance..

Abhishek

A: 

create your own scrollview and override all scrolling related function to do your custom actions.

In the listview you can make use of

[AbsListView.OnScrollListener][1]

to make magic :-)

the100rabh
Hey sorry I'll reframe my question. I'm not using a scrollview anymore. I have two lists being displayed in my activity. I heard that using a listview within a scrollview causes issues. So I need a way where in I can scroll both the lists simultaneously.Does that mean I need to override some functions of a listview.Thanks
in that case you can make use of AbsListView.OnScrollListener, which can be set on a listview as explained here http://developer.android.com/reference/android/widget/AbsListView.html#setOnScrollListener%28android.widget.AbsListView.OnScrollListener%29
the100rabh
I Agree...And i do have an OnScrollListener implemented, but then it gives me the firstVisible and lastVisble item for a list say A in OnScroll function, then how could I scroll another list B programmatically in A's OnScroll function. since there are only two api's (scrollby and scrollto) available for scrolling a list, and both of them accept the distances and not positions.
You also get view, use that to do get the scroll position of the list and other data that u may need
the100rabh
Sorry, but if you could tell me what do we need to call to get the scrolled position using the view parameter.