I have a Vertical
RecyclerView
, and this vertical RecyclerView's
each item contains Horizontal RecyclerView
. so I have done this and working fine except the performance factor, when I scroll the Vertical RecyclerView
the vertical list flickers and gives a bad behaviour. I am setting Adapter
for horizontal RecyclerView
is inside Vertical RecyclerView
so each time scrolls I am creating a new adapter and setting the data, actually this causes the performance. Is there any way to optimize this ?
Code
onBindViewHolder(){
setHorizontalList(items, horizontalolder);
}
setHorizontalList(ArrayList<Item> items, HorizontalHolder holder){
MyAdapter adapter = new MyAdapter();
adapter.setData(items);
holder.recyclerView.setAdapter(adapter);
holder.recyclerView.setLayoutManager(new LinearLayoutManager(mContext,
LinearLayoutManager.HORIZONTAL, false));
holder.recyclerView.setHasFixedSize(true);
}