3

i have struggled with this [nested recyclerview] problems.

The biggest issue about this is performance.

When i scrolling down or upside, annoying laggy is occur.

I found some advice that [using expandable recyclerview, rather than using nested recyclerview] but, i cannot adjust it to mycase.

i'll attach my structure, and some code of mine.

Would you check it and give me some nice tips? Thx in advance.

  • 1> This is my list item structure. Recyclerview with CardView item and each cardView has list item. its length is variable, so i made it by recyclerview.

 RECYCLERVIEW STRUCTURE

  • 2> This is my code.
  • Code in ViewHolder

    public static class ViewHolder extends RecyclerView.ViewHolder {
    ...
        ImageView issueImg;
        RecyclerView issue_poll_detail_list;
    ...
        RelativeLayout commentLayout;
        TextView commentTxt;
    ...
    
    public ViewHolder(View view) {
        super(view);
    
        issueImg = (ImageView) view.findViewById(R.id.issue_card_img);
    
        issue_poll_detail_list = (RecyclerView) view.findViewById(R.id.issue_poll_detail_list);
        issue_poll_detail_list.setNestedScrollingEnabled(false);
        issue_poll_detail_list.setHasFixedSize(true);
        issue_poll_detail_list.setFocusable(false);
    
        issue_poll_detail_list.setDescendant...(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
        issue_poll_detail_list.setFocusableInTouchMode(false);
    
        ...
        commentLayout = (RelativeLayout) view.findViewById(R.id.issue_poll_footer_reply);
        commentTxt = (TextView) view.findViewById(R.id.issue_poll_footer_reply_txt);
    
        ...
    

& * Code in Adapter

    holder.issue_poll_detail_list.setLayoutManager(new WrapContentLinearLayoutManager(context));
    ((SimpleItemAnimator) holder.issue_poll_detail_list.getItemAnimator()).setSupportsChangeAnimations(false);

    pollAdapter = new PollAdapter(context, glideRequestManager, issuePolls.get(holder.getAdapterPosition()), issuePolls.get(holder.getAdapterPosition()).getNumAnswer(),
            issuePolls.get(holder.getAdapterPosition()).getCalcStartTime(), issuePolls.get(holder.getAdapterPosition()).getCalcEndTime());


    holder.issue_poll_detail_list.setAdapter(pollAdapter);

Thx !!!

JungHoon
  • 302
  • 1
  • 4
  • 17

0 Answers0