こんにちは、RecyclerView
と同じを画像に示すように追加しますが、すでに最初にrecyclerview を行っています。私は既存のコードでもう1つを追加する方法を知りません。私を助けてください。マイRecyclerView
コード2つのリサイクルビューを同じフレームに追加するには
Communication.class
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_communication_summary, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.comm_expected_recycler_view);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setHasFixedSize(true);
mRecyclerViewLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mRecyclerViewLayoutManager);
private class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.ViewHolder> {
private List<CommunicationVO> mCommunicationVOsList;
public MyRecyclerViewAdapter(List<CommunicationVO> communicationVOsList) {
mCommunicationVOsList = communicationVOsList;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.communication_summary_list_item, parent, false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (holder != null) {
CommunicationVO communicationVO = mCommunicationVOsList.get(position);
holder.expInvoiceNumber.setText(communicationVO.getExpInvoiceNumber());
holder.expAmount.setText(CashPunditUtils.formatAmount(communicationVO.getExpAmount()));
holder.expDueDate.setText(CashPunditUtils.formatDate(CashPunditUtils.extractDateAndTime(communicationVO.getExpDueDate()), "dd-MMM-yy"));
holder.expPromisedDate.setText(CashPunditUtils.formatDate(CashPunditUtils.extractDateAndTime(communicationVO.getExpPromisedDate()), "dd-MMM-yy"));
}
}
@Override
public int getItemCount() {
return mCommunicationVOsList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView expInvoiceNumber, expAmount, expDueDate, expPromisedDate;
public ViewHolder(View itemView) {
super(itemView);
expInvoiceNumber = (TextView) itemView.findViewById(R.id.textview_invnum);
expAmount = (TextView) itemView.findViewById(R.id.textview_amount);
expDueDate = (TextView) itemView.findViewById(R.id.textview_duedate);
expPromisedDate = (TextView) itemView.findViewById(R.id.textview_promisedate);
}
}
https://stackoverflow.com/questions/26245139/how-to-create-recyclerview-with-multiple-view-type –