RecyclerView 中的多个 ListView
Multiple ListViews in RecyclerView
我想在我的每个 RecyclerView
项目下面有多个 listViews
。最初,每个都将被隐藏,但当用户点击通话记录项目时,该项目将展开,显示下面的详细信息,如下所示。我有一个 List
变量,它包含所有可用的日志详细信息,并且我将其传递到我的 ListView:
mLogsList.setAdapter(new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
当我打印 mLogs 时,它会显示所有可用的日志详细信息,但是当我将它传递到 RecyclerView
项目时,它总是只显示所有条目的第一个日志。
关于我做错了什么有什么想法吗?
更多上下文:
List<CallLog> mLogs = Arrays.asList(LinphoneManager.getCore().getCallLogs());
CallLog log = mLogs.get(getAdapterPosition());
Address address = log.getFromAddress();
String mSipUri = (address != null) ? address.asString() : "";
if (mSipUri != null) {
address = Factory.instance().createAddress(mSipUri);
Core core = LinphoneManager.getCore();
if (address != null && core != null) {
address.clean();
ProxyConfig proxyConfig = core.getDefaultProxyConfig();
CallLog[] logs;
if (proxyConfig != null) {
logs = core.getCallHistory(address, proxyConfig.getIdentityAddress());
} else {
logs = core.getCallHistoryForAddress(address);
}
mLogsList.setAdapter(
new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
mLogsList.setVerticalScrollBarEnabled(false);
mLogsList.setEnabled(false);
}
非常感谢您的努力,但在我看来,您可以将 listItem 视为一个部分。
有一个非常好用的可扩展 RecyclerView 库。你的案子很受欢迎,我个人以前也遇到过。
所以我建议使用 this library It would provide you with a solution for sectioned RecyclerView. and to be me more specific you can see this example 用于可扩展的分段 RecyclerView。
希望对您有所帮助。
我想在我的每个 RecyclerView
项目下面有多个 listViews
。最初,每个都将被隐藏,但当用户点击通话记录项目时,该项目将展开,显示下面的详细信息,如下所示。我有一个 List
变量,它包含所有可用的日志详细信息,并且我将其传递到我的 ListView:
mLogsList.setAdapter(new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
当我打印 mLogs 时,它会显示所有可用的日志详细信息,但是当我将它传递到 RecyclerView
项目时,它总是只显示所有条目的第一个日志。
关于我做错了什么有什么想法吗?
更多上下文:
List<CallLog> mLogs = Arrays.asList(LinphoneManager.getCore().getCallLogs());
CallLog log = mLogs.get(getAdapterPosition());
Address address = log.getFromAddress();
String mSipUri = (address != null) ? address.asString() : "";
if (mSipUri != null) {
address = Factory.instance().createAddress(mSipUri);
Core core = LinphoneManager.getCore();
if (address != null && core != null) {
address.clean();
ProxyConfig proxyConfig = core.getDefaultProxyConfig();
CallLog[] logs;
if (proxyConfig != null) {
logs = core.getCallHistory(address, proxyConfig.getIdentityAddress());
} else {
logs = core.getCallHistoryForAddress(address);
}
mLogsList.setAdapter(
new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
mLogsList.setVerticalScrollBarEnabled(false);
mLogsList.setEnabled(false);
}
非常感谢您的努力,但在我看来,您可以将 listItem 视为一个部分。 有一个非常好用的可扩展 RecyclerView 库。你的案子很受欢迎,我个人以前也遇到过。 所以我建议使用 this library It would provide you with a solution for sectioned RecyclerView. and to be me more specific you can see this example 用于可扩展的分段 RecyclerView。
希望对您有所帮助。