我一直在努力解决这个[嵌套回收查看]问题。
关于这一点的最大问题是表现。
当我向下或向上滚动时,会发生令人讨厌的迟滞。
我找到了一些建议[使用可扩展的recyclerview,而不是使用嵌套的recyclerview]但是,我无法将其调整为mycase。
我会附上我的结构和我的一些代码。
你会检查它并给我一些不错的提示吗? Thx提前。
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);
...
&安培; *适配器中的代码
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 !!!