Hello, I received json data in recyclerview from a fragment and sprayed it, and when I clicked on the view, the Gone had view appeared below. By the way, I want to get json data in the view that appeared, so is it possible to put recyclerView in recyclerView? If not, how should I do it? <
recyclerview adapter fragment
Of course it's possible. I think it would be easy to understand if you think of it as simply putting ViewGroup in ViewGroup. In the past, Similar questions are answered, but the part to be pointed out is the UI that can only be created by putting a recycler view in the recycler viewAuthorization.
I think it's going to be like this. When showing the data received in No. 4 as a View, make sure that the view can be made into a view group such as Linear Layout and Relative Layout as an alternative to Recycler View.
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
final BestCommentsRvItem item = bestCommentsRvItemArrayList.get(position);
holder.Best_comments_Name.setText(item.best_comments_name);
holder.Best_comments_content.setText(item.spanned_content);
holder.Best_comments_replyCounts.setText(item.best_comments_replyCounts);
holder.Best_comments_likeCount.setText(item.best_comments_likeCount);
holder.Best_comments_dislikeCount.setText(item.best_comments_dislikeCount);
holder.Best_comments_Time.setText(item.best_comments_time);
holder.Best_RvLL.setVisibility(item.visibility ? View.GONE : View.VISIBLE);
holder.Best_comments_replyCounts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(item.visibility) {
try {
adapter2 = new ReplyCommentsRvAdapter(replyCommentsRvItemArrayList2);
holder.Best_comments_RvRv.setAdapter(adapter2);
writeReplyCommentInterface.doGetReplyRequest(url + item.id, adapter2,
replyCommentsRvItemArrayList2);
} } catch (IOException e) {
e.printStackTrace();
}
holder.Best_RvLL.setVisibility(View.VISIBLE);
item.visibility=false;
} } else if(!item.visibility) {
holder.Best_RvLL.setVisibility(View.GONE);
item.visibility=true;
}
}
});
Picasso.with(context).load(item.getBest_comments_ImageView()).resize(70,70).into(holder.Best_comments_Iv);
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView Best_comments_Name;
TextView Best_comments_Time;
ImageView Best_comments_Iv;
TextView Best_comments_content;
TextView Best_comments_replyCounts;
TextView Best_comments_likeCount;
TextView Best_comments_dislikeCount;
//TextView Best_comments_BEST;
LinearLayout Best_RvLL;
LinearLayout Best_LL;
RecyclerView Best_comments_RvRv;
LinearLayoutManager llm2;
public ViewHolder(View itemView) {
super(itemView);
Best_comments_Name = (TextView) itemView.findViewById(R.id.best_comments_name);
Best_comments_Time = (TextView) itemView.findViewById(R.id.best_comments_time);
Best_comments_content = (TextView) itemView.findViewById(R.id.best_comments_content);
Best_comments_likeCount = (TextView) itemView.findViewById(R.id.best_comments_likeCount);
Best_comments_dislikeCount = (TextView) itemView.findViewById(R.id.best_comments_dislikeCount);
Best_comments_replyCounts = (TextView) itemView.findViewById(R.id.best_comments_replyCounts);
Best_comments_Iv = (ImageView) itemView.findViewById(R.id.best_comments_Iv);
// // Best_comments_BEST = (TextView) itemView.findViewById(R.id.best_comments_BEST);
Best_RvLL = (LinearLayout) itemView.findViewById(R.id.bestRVLL);
Best_LL = (LinearLayout) itemView.findViewById(R.id.bestLL);
Best_comments_RvRv = (RecyclerView) itemView.findViewById(R.id.bestRvRv);
llm2 = new LinearLayoutManager(itemView.getContext());
llm2.setOrientation(LinearLayoutManager.VERTICAL);
Best_comments_RvRv.setLayoutManager(llm2);
}
}
}
In this way, I put another recycling view in the adapter of recycling view, but I tried to communicate with the data by defining the parent recycling view through the interface, but it didn't work well. 어떡 What should I do?Yo
© 2024 OneMinuteCode. All rights reserved.