资源简介
XListView是一个ListView,对其进行功能的完善和封装,封装了下拉刷新和下拉加载,使用说明:请参考:http://blog.csdn.net/forwardyzk/article/details/24597597
希望对大家有帮助!
代码片段和文件信息
package me.maxwin;
import java.util.ArrayList;
import me.maxwin.view.XListView;
import me.maxwin.view.XListView.IXListViewListener;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ArrayAdapter;
public class XListViewActivity extends Activity implements IXListViewListener {
private XListView mListView;
private ArrayAdapter mAdapter;
private ArrayList items = new ArrayList();
private Handler mHandler;
private int start = 0;
private static int refreshCnt = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
geneItems();
mListView = (XListView) findViewById(R.id.xListView);
mListView.setPullLoadEnable(true);
mAdapter = new ArrayAdapter(this R.layout.list_item items);
mListView.setAdapter(mAdapter);
// mListView.setPullLoadEnable(false);
// mListView.setPullRefreshEnable(false);
mListView.setXListViewListener(this);
mHandler = new Handler();
}
private void geneItems() {
for (int i = 0; i != 20; ++i) {
items.add(“refresh cnt “ + (++start));
}
}
private void onload() {
mListView.stopRefresh();
mListView.stopLoadMore();
mListView.setRefreshTime(“刚刚“);
}
@Override
public void onRefresh() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
start = ++refreshCnt;
items.clear();
geneItems();
// mAdapter.notifyDataSetChanged();
mAdapter = new ArrayAdapter(XListViewActivity.this R.layout.list_item items);
mListView.setAdapter(mAdapter);
onload();
}
} 2000);
}
@Override
public void onloadMore() {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
geneItems();
mAdapter.notifyDataSetChanged();
onload();
}
} 2000);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-02-11 13:20 XListView-Android-master\
文件 356 2014-02-11 13:20 XListView-Android-master\.classpath
文件 812 2014-02-11 13:20 XListView-Android-master\.project
文件 708 2014-02-11 13:20 XListView-Android-master\AndroidManifest.xm
文件 1248 2014-02-11 13:20 XListView-Android-master\proguard.cfg
文件 382 2014-02-11 13:20 XListView-Android-master\project.properties
文件 162 2014-02-11 13:20 XListView-Android-master\README
目录 0 2014-02-11 13:20 XListView-Android-master\res\
目录 0 2014-02-11 13:20 XListView-Android-master\res\drawable-hdpi\
文件 4147 2014-02-11 13:20 XListView-Android-master\res\drawable-hdpi\ic_launcher.png
文件 1456 2014-02-11 13:20 XListView-Android-master\res\drawable-hdpi\xlistview_arrow.png
目录 0 2014-02-11 13:20 XListView-Android-master\res\drawable-ldpi\
文件 1723 2014-02-11 13:20 XListView-Android-master\res\drawable-ldpi\ic_launcher.png
目录 0 2014-02-11 13:20 XListView-Android-master\res\drawable-mdpi\
文件 2574 2014-02-11 13:20 XListView-Android-master\res\drawable-mdpi\ic_launcher.png
目录 0 2014-02-11 13:20 XListView-Android-master\res\layout\
文件 313 2014-02-11 13:20 XListView-Android-master\res\layout\list_item.xm
文件 637 2014-02-11 13:20 XListView-Android-master\res\layout\main.xm
文件 991 2014-02-11 13:20 XListView-Android-master\res\layout\xlistview_footer.xm
文件 2459 2014-02-11 13:20 XListView-Android-master\res\layout\xlistview_header.xm
目录 0 2014-02-11 13:20 XListView-Android-master\res\values\
文件 619 2014-02-11 13:20 XListView-Android-master\res\values\strings.xm
目录 0 2014-02-11 13:20 XListView-Android-master\screenshots\
文件 80684 2014-02-11 13:20 XListView-Android-master\screenshots\load_more_loading.png
文件 68838 2014-02-11 13:20 XListView-Android-master\screenshots\load_more_normal.png
文件 67322 2014-02-11 13:20 XListView-Android-master\screenshots\load_more_ready.png
文件 74790 2014-02-11 13:20 XListView-Android-master\screenshots\refresh_loading.png
文件 71665 2014-02-11 13:20 XListView-Android-master\screenshots\refresh_normal.png
文件 71582 2014-02-11 13:20 XListView-Android-master\screenshots\refresh_ready.png
目录 0 2014-02-11 13:20 XListView-Android-master\src\
目录 0 2014-02-11 13:20 XListView-Android-master\src\me\
............此处省略6个文件信息
- 上一篇:黄土高原边界shapefile文件
- 下一篇:74HC573驱动数码管显示程序
评论
共有 条评论