本文整理了Java中androidx.recyclerview.widget.GridLayoutManager.findFirstVisibleItemPosition()
方法的一些代码示例,展示了GridLayoutManager.findFirstVisibleItemPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.findFirstVisibleItemPosition()
方法的具体详情如下:
包路径:androidx.recyclerview.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:findFirstVisibleItemPosition
暂无
代码示例来源:origin: nickbutcher/plaid
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
// we want the grid to scroll over the top of the toolbar but for the toolbar items
// to be clickable when visible. To achieve this we play games with elevation. The
// toolbar is laid out in front of the grid but when we scroll, we lower it's elevation
// to allow the content to pass in front (and reset when scrolled to top of the grid)
if (newState == RecyclerView.SCROLL_STATE_IDLE
&& layoutManager.findFirstVisibleItemPosition() == 0
&& layoutManager.findViewByPosition(0).getTop() == grid.getPaddingTop()
&& toolbar.getTranslationZ() != 0) {
// at top, reset elevation
toolbar.setTranslationZ(0f);
} else if (newState == RecyclerView.SCROLL_STATE_DRAGGING
&& toolbar.getTranslationZ() != -1f) {
// grid scrolled, lower toolbar to allow content to pass in front
toolbar.setTranslationZ(-1f);
}
}
};
代码示例来源:origin: mikepenz/FastAdapter
firstVisiblePosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
} else if (mRecyclerView.getLayoutManager() instanceof GridLayoutManager) {
firstVisiblePosition = ((GridLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
代码示例来源:origin: mikepenz/ItemAnimators
position = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
} else if (mRecyclerView.getLayoutManager() instanceof GridLayoutManager) {
position = ((GridLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
position = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
} else if (mRecyclerView.getLayoutManager() instanceof GridLayoutManager) {
position = ((GridLayoutManager) mRecyclerView.getLayoutManager()).findFirstVisibleItemPosition();
内容来源于网络,如有侵权,请联系作者删除!