XListview

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了XListview相关的知识,希望对你有一定的参考价值。


需要导入library


 //找控件
        xlv = (XListView) findViewById(R.id.xlv);
        xlv.setPullRefreshEnable(true);
        xlv.setPullLoadEnable(true);
        //设置刷新监听
        xlv.setXListViewListener(new XListView.IXListViewListener() {
            @Override
            public void onRefresh() {

                Toast.makeText(MainActivity.this, "下拉刷新", Toast.LENGTH_SHORT).show();
            
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        //停止

                        xlv.stopRefresh();
                    }
                }, 2000);
            }

            @Override
            public void onLoadMore() {
        Toast.makeText(MainActivity.this, "上拉加载", Toast.LENGTH_SHORT).show();                                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        //停止
                        xlv.stopLoadMore();
                    }
                }, 2000);
            }
        });

以上是关于XListview的主要内容,如果未能解决你的问题,请参考以下文章