本文整理了Java中android.support.v7.widget.GridLayoutManager.scrollToPositionWithOffset()
方法的一些代码示例,展示了GridLayoutManager.scrollToPositionWithOffset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.scrollToPositionWithOffset()
方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:scrollToPositionWithOffset
暂无
代码示例来源:origin: alibaba/Tangram-Android
GridLayoutManager lm = (GridLayoutManager) recyclerView.getLayoutManager();
int position = computeFirstCompletelyVisibleItemPositionForScrolledX(starts);
lm.scrollToPositionWithOffset(position * lSCell.maxRows, (int) (starts[position] - lSCell.currentDistance));
代码示例来源:origin: alibaba/Tangram-Android
GridLayoutManager lm = (GridLayoutManager) recyclerView.getLayoutManager();
int position = computeFirstCompletelyVisibleItemPositionForScrolledX(starts);
lm.scrollToPositionWithOffset(position * lSCell.maxRows, (int) (starts[position] - lSCell.currentDistance));
代码示例来源:origin: seewhy163/IndexableRecyclerView
@Override
public void onLetterSelect(int position, String letter, boolean confirmed) {
if (confirmed) {
mTipText.setVisibility(View.GONE);
} else {
mTipText.setVisibility(View.VISIBLE);
mTipText.setText(letter);
}
Integer sectionPosition = mRecyclerAdapter.getSectionPosition(position);
if (sectionPosition != null)
gridLayoutManager.scrollToPositionWithOffset(sectionPosition, 0);
}
});
代码示例来源:origin: 348476129/gank.io-with-MVVM
@Override
public void initView(@Nullable Bundle savedInstanceState) {
mGridLayoutManager.scrollToPositionWithOffset(fuliViewModel.getPosition(), fuliViewModel.getLastOffset());
}
代码示例来源:origin: w446108264/StickHeaderLayout
private void checkAdapterDataObserver(){
if (((RecyclerView) mScrollItemView).getLayoutManager() != null) {
if (((RecyclerView) mScrollItemView).getLayoutManager() instanceof LinearLayoutManager) {
float recyclerViewBottom = mScrollItemView.getBottom();
int countCount = (((RecyclerView) mScrollItemView).getLayoutManager()).getChildCount();
if(countCount > 0){
float lastChildViewBottom = (((RecyclerView) mScrollItemView).getLayoutManager()).getChildAt(countCount - 1).getBottom();
float contentViewHeight = lastChildViewBottom - mScrollHeight;
if(contentViewHeight + mHeaderHeight < recyclerViewBottom){
if(mStickHeaderViewPagerManager != null){
mRecyclerViewScrollY = 0;
(((RecyclerView) mScrollItemView).getLayoutManager()).scrollToPosition(0);
mStickHeaderViewPagerManager.onRecyclerViewScroll((RecyclerView) mScrollItemView, mRecyclerViewScrollY, mPosition, true);
}
}
}
} else if (((RecyclerView) mScrollItemView).getLayoutManager() instanceof GridLayoutManager) {
((GridLayoutManager) ((RecyclerView) mScrollItemView).getLayoutManager()).scrollToPositionWithOffset(0, -mRecyclerViewScrollY);
}
}
}
代码示例来源:origin: luhaoaimama1/LollipopTransition
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onActivityReenter(int resultCode, Intent data) {
super.onActivityReenter(resultCode, data);
isReturn = true;
returnIndex = data.getIntExtra("position", 0);
// final int[] info = RecyclerUtils.getShowInfo(rv, adapter);
// if (returnIndex > info[1] || returnIndex < info[0]) {
layout.scrollToPositionWithOffset(returnIndex, 0);//这个方法略屌 比下面的精准 让整个item显示出来了
// layout.scrollToPosition(returnIndex);//todo 是他的问题 没有让他全部显示出来;
// System.out.println("滚动到 position:" + returnIndex);
// }
postponeEnterTransition();
rv.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
rv.getViewTreeObserver().removeOnPreDrawListener(this);
startPostponedEnterTransition();
return true;
}
});
}
代码示例来源:origin: w446108264/StickHeaderLayout
((GridLayoutManager) ((RecyclerView) mScrollItemView).getLayoutManager()).scrollToPositionWithOffset(0, -mRecyclerViewScrollY);
代码示例来源:origin: msahakyan/nested-recycler-view
notifyItemRangeChanged(relatedItemsPosition, mItemList.size());
if (mRecyclerView != null && relatedItemsPosition > 1) {
((GridLayoutManager) mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(relatedItemsPosition - 1, 0);
内容来源于网络,如有侵权,请联系作者删除!