HVScrollView
仿同花顺自选股、持仓股多列可横向滚动的ListView
Install / Use
/learn @haipinghuang/HVScrollViewREADME
HVScrollView
仿同花顺自选股、持仓股多列可横向滚动的ListView,可支持松开手指后自动滑动到临界点。
- 支持设定每列的列头内容
- 支持设定第一列(即固定列)的宽度
- 支持设定默认显示可以滚动的列数
- 支持设定是否松开手指后自动滑动到临界点
- 支持设定自定义ListView adapter
- 支持放在ViewPage内使用,效果不是很理想
效果图

使用
下载源码,导入hvlistview库
hvScrollView = view.findViewById(R.id.scrollView);
hvScrollView.setScrollConfig(new ScrollConfig() {
@Override
public int getFixedColWidth() {
float value = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics());
return (int) value;
}
@Override
public int getShowCols() {
return 2;
}
@Override
public int[] getShowViewIds() {
return new int[]{R.id.tvCol1, R.id.tvCol2, R.id.tvCol3, R.id.tvCol4, R.id.tvCol5, R.id.tvCol6, R.id.tvCol7};
}
@Override
public int getScrollParentViewId() {
return R.id.llContainer;
}
});
hvScrollView.setHeaderListData(title, new String[]{"列表1", "列表2", "列表3", "列表4", "列表5", "列表6", "列表7"});
hvScrollView.setAnimate2Int(false);
hvScrollView.setViewPage(mViewPage);
hvScrollView.setAdapter(new MyBaseAdapter<LvBean>(getContext(), list) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.item_hscroll_lv, parent, false);
}
LvBean item = getItem(position);
((TextView) convertView.findViewById(R.id.tvFixCol)).setText(item.fixedCol);
((TextView) convertView.findViewById(R.id.tvCol1)).setText(item.movCol1);
((TextView) convertView.findViewById(R.id.tvCol2)).setText(item.movCol2);
((TextView) convertView.findViewById(R.id.tvCol3)).setText(item.movCol3);
((TextView) convertView.findViewById(R.id.tvCol4)).setText(item.movCol4);
((TextView) convertView.findViewById(R.id.tvCol5)).setText(item.movCol5);
((TextView) convertView.findViewById(R.id.tvCol6)).setText(item.movCol6);
((TextView) convertView.findViewById(R.id.tvCol7)).setText(item.movCol7);
return convertView;
}
});
TODO
- 支持瞬滑
- 完美支持和Viewpage结合事件不冲突
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
