Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andjdk/HVScrollListView
HVScrollListView是一个可以实现横纵滑动的列表控件。如股票列表
https://github.com/andjdk/HVScrollListView
Last synced: about 1 month ago
JSON representation
HVScrollListView是一个可以实现横纵滑动的列表控件。如股票列表
- Host: GitHub
- URL: https://github.com/andjdk/HVScrollListView
- Owner: andjdk
- Created: 2016-10-11T02:50:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-17T06:14:29.000Z (over 7 years ago)
- Last Synced: 2024-08-02T01:25:10.383Z (4 months ago)
- Language: Java
- Homepage:
- Size: 2.82 MB
- Stars: 46
- Watchers: 3
- Forks: 17
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - HVScrollListView - 实现横纵滑动的列表控件 (表格(Table))
README
# HVScrollListView
---
HVScrollListView是一个可以实现横纵滑动的列表控件。如股票列表。以下为使用此控件实现的效果图:
![](https://github.com/andjdk/HVScrollListView/blob/master/index.gif)##版本升级
hvscrollviewlibrary-1.0hvscrollviewlibrary-1.0.1 :增加了上拉加载更多
##使用方式
###step 1:
a、把hvscrollviewlibrary-1.0.aar粘贴到lib目录下。b、在build.gradle中增加`repositories {
flatDir {
dirs 'libs'
}
}` 和dependencies中增加`compile(name: 'hvscrollviewlibrary-1.0', ext: 'aar')`这句,然后sync。这样就可以在项目中使用了
###step 2
HVScrollView hvScrollView= (HVScrollView) findViewById(R.id.hv_scrollview);
List stockDataInfoList=new ArrayList<>();
for (int i = 0; i < 30; i++) {
StockDataInfo stockDataInfo=new StockDataInfo();
stockDataInfo.setStockName("浦发银行");
stockDataInfo.setStockCode("600000");
stockDataInfo.setPriceLastest("13.08");
stockDataInfo.setPriceOffsetRate("0.10");
stockDataInfo.setPriceHigh("13.10");
stockDataInfo.setPriceLow("12.80");
stockDataInfo.setPriceOpen("12.90");
stockDataInfo.setPricePreClose("12.90");
stockDataInfo.setTradVulumes("12.90");
stockDataInfo.setTotalMarketValue("12.90");
stockDataInfoList.add(stockDataInfo);
}
//定义顶部栏
hvScrollView.setHeaderListData(new String[]{"最新价", "涨跌幅", "最高价", "最低价", "开盘价", "收盘价","成交量","总市值"});
//初始化adapter
StockListAdapter mAdapter=new StockListAdapter(this,stockDataInfoList,R.layout.item_layout);
hvScrollView.setAdapter(mAdapter);
注意:
- 1、StockListAdapter必须继承CommonAdapter
- 2、R.layout.item_layout布局中实现滑动部分的layout必须是**LinearLayout**包裹且定义的id必须定义为 **android:id="@+id/move\_layout"**
如下
###step 3:在adapter中初始化数据
public class StockListAdapter extends CommonAdapter {public StockListAdapter(Context mContext, List mDatas, int layoutId) {
super(mContext, mDatas, layoutId);
}@Override
public void convert(ViewHolder holder, StockDataInfo stockDataInfo, int position, ArrayList movableViewList) {
holder.setText(R.id.text1,stockDataInfo.getStockName());
holder.setText(R.id.text2,stockDataInfo.getPriceLastest());
holder.setText(R.id.text3,stockDataInfo.getPriceOffsetRate());
holder.setText(R.id.text4,stockDataInfo.getPriceHigh());
holder.setText(R.id.text5,stockDataInfo.getPriceLow());
holder.setText(R.id.text6,stockDataInfo.getPriceOpen());
holder.setText(R.id.text7,stockDataInfo.getPricePreClose());
holder.setText(R.id.text8,stockDataInfo.getTradVulumes());
holder.setText(R.id.text9,stockDataInfo.getTotalMarketValue());
}}###实现点击列表
//点击列表item
hvScrollView.setOnItemClick(new HVScrollView.OnItemClickedListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
Toast.makeText(MainActivity.this,position+"",Toast.LENGTH_SHORT).show();
}
});
//点击头部按钮
hvScrollView.setOnHeaderClickedListener(new HVScrollView.OnHeaderClickedListener() {
@Override
public void onHeadViewClick(String string) {
Toast.makeText(MainActivity.this,string,Toast.LENGTH_SHORT).show();
}
});###1.0.1上拉加载更多
hvScrollView.setOnLoadMoreListener(new HVScrollView.OnLoadMoreListener() {
@Override
public void onLoadingMore() {
//TODO}
});
//加载成功之后调用此方法
hvScrollView.onLoadingComplete();到这里就可以是实现想要的功能了,是不是很简单。当然目前还没有增加上拉刷新向下加载更多的功能,这功能还在完善中,敬请期待。如在使用中遇到有什么问题也可以直接联系我。加群:462723796 欢迎大家star或者fork