I'm creating an EPG like view for which I have multiple horizontal RecyclerView
s (as tv programs) encapsulated inside a LinearLayout. When I scroll one of the RecyclerView, I want the rest of the views to be scrolled together.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
layoutContent.setWeightSum(epg.getChannels().size());
//prepare recycler views and add into layoutContent based on epg channels
for(EPG.Channel ch : epg.getChannels()){
AppLog.error(TAG, "Creating RecyclerView for: " + ch.getDisplayName());
//create new recycler view
final RecyclerView rv = new RecyclerView(layoutContent.getContext());
lstRecyclerViews.add(rv);
//set layout manager
rv.setLayoutManager(new LinearLayoutManager(layoutContent.getContext(), LinearLayoutManager.HORIZONTAL, false));
//create adapter
rv.setAdapter(new MyAdapter(ch.getPrograms()));
rv.setItemAnimator(new DefaultItemAnimator());
//add into parent layout
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);
lp.weight = 1;
layoutContent.addView(rv, lp);
}
}
I've tried adding a scroll listener to my views but I'm confused with RecyclerView.OnScrollListener
's onScrolled method as i can't figure out how to scroll other views.
Any help/suggestion would be helpful.
LinearLayoutManager
is not a final decision :) but even if I use staggered view, so how do I scroll all the RecyclerViews all together when one of the view is scrolled? – BastGAP_HANDLING_NONE
– Aloke