当前位置:网站首页>Recyclerview scrolls to the specified location
Recyclerview scrolls to the specified location
2022-06-25 12:17:00 【User 9854323】
1、mLayoutManager
private void moveToPosition(int position) {
if (position >= 0) {
mLayoutManager.scrollToPositionWithOffset(3, 0);
}
}
2、LinearSmoothScroller
mTopSmoothScroller = new TopSmoothScroller(getActivity());
private void smoothScroll(int position) {
mRecyclerView.postDelayed(new Runnable() {
@Override
public void run() {
if (!isDetached() && position >= 0 && getActivity() != null && mTopSmoothScroller != null) {
mTopSmoothScroller.setTargetPosition(position);
mLayoutManager.startSmoothScroll(mTopSmoothScroller);
}
}
}, 0);
}
TopSmoothScroller:
public class TopSmoothScroller extends LinearSmoothScroller {
public TopSmoothScroller(Context context) {
super(context);
}
@Override
protected int getHorizontalSnapPreference() {
return SNAP_TO_START;// See the source code Notes for details
}
@Override
protected int getVerticalSnapPreference() {
return SNAP_TO_START;// See the source code Notes for details
}
}
3、RecyclerView Of
scrollBy(int x, int y)
scrollToPosition(int position)
边栏推荐
- Continue to cut the picture after the ArcGIS Server is disconnected
- PyCaret 成功解决无法从‘sklearn.model_selection._search‘导入名称“_check_param_grid”
- confluence7.4. X upgrade record
- VFP calls the command line image processing program, and adding watermark is also available
- R语言使用epiDisplay包的followup.plot函数可视化多个ID(病例)监测指标的纵向随访图、使用stress.type参数指定强调线的id子集的线条的类型(type)
- VFP a picture processing library, simple and easy to use, free of charge, worth recommending
- devsecops与devops的理解与建设
- R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验(检验模型效果)
- What should I do to dynamically add a column and button to the gird of VFP?
- R语言dist函数计算dataframe数据中两两样本之间的距离返回样本间距离矩阵,通过method参数指定距离计算的方法、例如欧几里得距离
猜你喜欢
20、wpf之MVVM命令绑定
[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?
为什么ping不通网站 但是却可以访问该网站?
Rank sum ratio comprehensive evaluation method for common models in mathematical modeling
黑马畅购商城---3.商品管理
A set of automated paperless office system (oa+ approval process) source code: with data dictionary
2022年首期Techo Day腾讯技术开放日将于6月28日线上举办
PD1.4转HDMI2.0转接线拆解。
揭秘GaussDB(for Redis):全面對比Codis
Oracle Spatial creating spatial tables
随机推荐
R语言caTools包进行数据划分、scale函数进行数据缩放、e1071包的naiveBayes函数构建朴素贝叶斯模型
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the lrtest function of epidisplay package to perform multiple model
19. Implementation of MVVM architecture based on WPF event to command
Is it safe to open an account and buy stocks? Who knows
R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、epiDisplay包的poisgof函数对拟合的泊松回归模型进行拟合优度检验(检验模型效果)
网络 | 衡量网络好坏的指标及测试方法
使用php脚本查看已开启的扩展
[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer
如果你也想做自媒体,不妨听大周给您点建议
Explain factor analysis in simple terms, with case teaching (full)
Use of JSP sessionscope domain
Dark horse shopping mall ---8 Microservice gateway and JWT token
Caused by: org. xml. sax. SAXParseException; lineNumber: 1; columnNumber: 10; Processing matching '[xx][mm][ll]' is not allowed
Cesium building loading (with height)
Database Series: MySQL index optimization summary (comprehensive version)
JS to realize the calculation of discrete aggregation points
PyCaret 成功解决无法从‘sklearn.model_selection._search‘导入名称“_check_param_grid”
图片打标签之获取图片在ImageView中的坐标
The temporary table from XML to VFP is simple and easy to use and worth collecting
Arm immediate