在java中,将两个不同的适配器添加到一个listView中



我想在单个页面中将两个适配器连接到一个列表视图中。

LoanApplicationAdapter adapter = new LoanApplicationAdapter(this, R.layout.item_loan, customerLoanApplicationList);
LoanAdapter adapter = new LoanAdapter(this, R.layout.item_loan,customerLoanList);
binding.listLoan.setAdapter(adapter);

上面的customerLoanApplicationList和customerLanList希望在我的android应用程序中显示在一个列表视图中。你能告诉我怎么做吗?

您可以做的一件事是,您可以在一个适配器中创建两个视图持有者。通过这样做,您可以为不同的视图持有者实现不同的逻辑,这将更加容易和准确。

(首选使用RecyclerView(

最新更新