当前位置:网站首页>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)边栏推荐
- 黑马畅购商城---3.商品管理
- Explain factor analysis in simple terms, with case teaching (full)
- Network related encapsulation introduced by webrtc native M96 basic base module
- Use of JSP sessionscope domain
- ARM V7 协处理器
- Thingspanel releases Internet of things mobile client (multiple pictures)
- 20. MVVM command binding of WPF
- What are redis avalanche, penetration and breakdown?
- ARM V7 ldr str 内存访问
- The dist function of R language calculates the distance between two samples in dataframe data, returns the distance matrix between samples, and specifies the distance calculation method through the me
猜你喜欢

刷入Magisk通用方法

Dark horse shopping mall ---2 Distributed file storage fastdfs

一款好用的印章设计工具 --(可转为ofd文件)

20、wpf之MVVM命令绑定

揭秘GaussDB(for Redis):全面對比Codis

A set of automated paperless office system (oa+ approval process) source code: with data dictionary

Thingspanel releases Internet of things mobile client (multiple pictures)

VFP uses Kodak controls to control the scanner to solve the problem that the volume of exported files is too large

Découvrir gaussdb (pour redis): une comparaison complète avec Codis

SQL server saves binary fields to disk file
随机推荐
JS judge whether a number is in the set
[论]Learning Dynamic and Hierarchical Traffic Spatiotemporal Features with Transformer
一款好用的印章设计工具 --(可转为ofd文件)
刷入Magisk通用方法
A set of automated paperless office system (oa+ approval process) source code: with data dictionary
VFP serial port communication is difficult for 9527. Maomao just showed his skill and was defeated by kiss
Database Series: MySQL index optimization summary (comprehensive version)
R语言使用scale函数对神经网络的输入数据进行最小最大缩放、把数据缩放到0到1之间、并划分数据集为训练集和测试集
Arm V7 continuous load / store
RecyclerView滚动到指定位置
Old ou, a fox friend, has had a headache all day. The VFP format is always wrong when it is converted to JSON format. It is actually caused by disordered code
R language dplyr package summary_ The at function calculates the count number, mean and median of multiple data columns (specified by vectors) in the dataframe data, and specifies na RM parameter, spe
devsecops与devops的理解与建设
confluence7.4.X升级实录
[data midrange] what is the oneid of the data midrange? Isn't the master data fragrant?
The idea of mass distribution of GIS projects
黑馬暢購商城---3.商品管理
19、wpf之事件转命令实现MVVM架构
sklearnex 让你的 sklearn 机器学习模型训练快得飞起?
Actual combat summary of Youpin e-commerce 3.0 micro Service Mall project