在可展开的 RecyclerView 中展开最后一个视图的可见性
Visibility of expanding last view in the expandable RecyclerView
我希望最后一个可展开项目中的内容在单击时完全可见,现在发生的情况意味着当我单击最后一个项目时它会向下展开,但我需要再次手动向上滚动才能看到展开后 item.How 中的内容最后一个可展开项是否完全可见。
我正在使用 Recyclerview。
我找到了我想要的解决方案,我使用了
recyclerView.smoothScrollToPosition(selectedPosition);
设置适配器后。所以现在最后一个可扩展项中的内容在单击时完全可见。
补充一下:
如果你使用h6ah4i/advrecyclerview,你可以使用下面的代码片段:
@Override
public boolean onHookGroupExpand(int groupPosition, boolean fromUser) {
// NOTE21: collapse all other groups when one item expand.
mExpMgr.collapseAll();
// NOTE21: Visibility of expanding last view in the expandable recyclerview
if (groupPosition == getGroupCount() - 1) {
mRecyclerView.smoothScrollToPosition(groupPosition + getChildCount(groupPosition));
}
return true;
}
我希望最后一个可展开项目中的内容在单击时完全可见,现在发生的情况意味着当我单击最后一个项目时它会向下展开,但我需要再次手动向上滚动才能看到展开后 item.How 中的内容最后一个可展开项是否完全可见。 我正在使用 Recyclerview。
我找到了我想要的解决方案,我使用了
recyclerView.smoothScrollToPosition(selectedPosition);
设置适配器后。所以现在最后一个可扩展项中的内容在单击时完全可见。
补充一下: 如果你使用h6ah4i/advrecyclerview,你可以使用下面的代码片段:
@Override
public boolean onHookGroupExpand(int groupPosition, boolean fromUser) {
// NOTE21: collapse all other groups when one item expand.
mExpMgr.collapseAll();
// NOTE21: Visibility of expanding last view in the expandable recyclerview
if (groupPosition == getGroupCount() - 1) {
mRecyclerView.smoothScrollToPosition(groupPosition + getChildCount(groupPosition));
}
return true;
}