The source address of the XListView control is Android”> https://github.com/Maxwin-z/XListView-Android
- [x] XListView function: pull-down refresh and pull-up loading these two functions-
[x] - How to use:
- [ ] 1. Get the XListView control.
- [ ] 2. Pull up to refresh setPullLoadEnable(true).
- [ ] 3. Add data, adapter.
- [ ] 4. Set the listener setXListViewListener(this) for xListView.
- [ ] 5. Implement onRefresh() and onLoadMore() methods.
- [ ] 6. Call onLoad() to close refresh and loading.
- [ ] 7. There must be header.xml and footer.xml in the layout. Add XListView control to the page.
- [x ] - Notes:
- [ ] 1. Set the listening event for XListViewListener. ListView.setXListViewListener(this).
- [ ] 2. Call the onLoad() method after getting the data.
- [ ] 3. Set the background color to transparent android:cacheColorHint =”#00000000”
<me.maxwin.view.XListView
android:id="@+id/xListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000" >
- [x] code block
- //加载更多可以用
xlv.setPullLoadEnable(true);
- //下拉刷新可以用
xlv.setPullRefreshEnable(true);
- //给xlistView高置它的监听事件
xlv.setXListViewListener(new XListView.IXListViewListener()
- //实现两个方法
onRefresh() 下拉刷新会调用此方法
onLoadMore() 加载更多会调用此方法
- [x] Common properties of XListView
- android:divider="#f9b68b" //分割线颜色
- android:dividerHeight="1dp" //分割线边距
- android:scrollbars="none" //不显示滚动条
- android:fadingEdge="none" 去掉上边和下边黑色的阴影
- setPullLoadEnable(true);//上拉刷新
- setPullRefreshEnable(false);//下拉刷新
- stopRefresh(); //停止刷新
- stopLoadMore(); //停止加载更多