Skip to content

An Android customed ListView that could auto load more data.一个自定义的ListView,可以自动加载更多,配合SwipeRefreshLayout使用更佳

Notifications You must be signed in to change notification settings

johnscliang/AutoLoadListView

Repository files navigation

AutoLoadListView

An Android customed ListView that could auto load more data 自定义ListView,可以自动加载更多。

Usage

Step 1

Use the customed view in xml layout file like that

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.lance.autoloadlistview.AutoLoadListView
            android:id="@+id/lv_data"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>

Step 2

Find view and set listener for load more.The Activity or the Fragment should implements AutoLoadListView.IonLoadMore.

 AutoLoadListView mLvData = (AutoLoadListView) findViewById(R.id.lv_data);
 mLvData.setOnLoadmoreListener(this,mContext);

Step 3

Set the adapter.When the AutoLoadListView scroll to the bottom,it would call the method onLoadMore();

 mAdapter = new ArrayAdapter(mContext,android.R.layout.simple_list_item_1,android.R.id.text1,data);
 mLvData.setAdapter(mAdapter);

sina sina sina

About

An Android customed ListView that could auto load more data.一个自定义的ListView,可以自动加载更多,配合SwipeRefreshLayout使用更佳

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages