chrisbanes / Android-PullToRefresh 控件使用(一)

来源:互联网 发布:龙腾软件 编辑:程序博客网 时间:2024/05/02 02:59

     1. 下拉刷新事件

mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {

这里应该使用多线程,避免阻塞

}

});

2. 设置 刷新之后的label

refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);

3. 设置刷新时的声音

SoundPullEventListener<ListView>soundListener = new SoundPullEventListener<ListView>(this);

// soundListener.addSoundEvent(State.PULL_TO_REFRESH, R.raw.pull_event); // 下拉刷新那一时刻

// soundListener.addSoundEvent(State.RESET, R.raw.reset_sound); // 刷新结束

// soundListener.addSoundEvent(State.REFRESHING, R.raw.refreshing_sound); // 正在刷新时


4. 设置是否有上拉刷新,或者下拉刷新

<com.handmark.pulltorefresh.library.PullToRefreshGridView

        xmlns:ptr="http://schemas.android.com/apk/res-auto"

        android:id="@+id/pull_refresh_grid"

        android:layout_height="fill_parent"

        android:layout_width="fill_parent"

        android:numColumns="auto_fit"

        android:verticalSpacing="1dp"

        android:horizontalSpacing="1dp"

        android:columnWidth="100dp"

        android:stretchMode="columnWidth"

        android:gravity="fill"

        ptr:ptrMode="both"

        />

在代码中也可以找到对应的方法




原创粉丝点击