Reputation: 133
I tried something like this but no luck. Is there any alternative?
public View getView(int position, View view, ViewGroup parent) {
ViewHolder holder;
if (view != null) {
holder = view.getTag();
} else {
view = LayoutInflater.from(activity).inflate(R.layout.something , parent, false);
holder = new ViewHolder(view);
view.setTag(holder);
}
holder.scrollView.scrollTo(x,y);
return view;
}
Upvotes: 0
Views: 165
Reputation: 2476
according to the comment :
Once i move the list view, i expect the scroll scroll to the x that is set. Unfortunately, it doesn't.
You need to listen to the scroll event of the scrollview something like this should work:
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int i) {
ScrollView sv = absListView.findViewById(R.id.yourScrollView);
sv.scrollTo(x,y);
/**
** absListView is the view that you scrolled to in your list view
** then you get your scrollView from the findViewById()
** then you scroll that scroll view using the method scrollTo(x,y)
**/
}
@Override
public void onScroll(AbsListView absListView, int i, int i1, int i2) {
}
});
Upvotes: 1