Android-PullToRefresh学习笔记

这篇博客记录了学习Android-PullToRefresh开源项目的经历,包括如何导入库和示例代码,设置无错误环境,以及如何通过监听滚动事件判断上拉或下拉。虽然项目未提供判断方向的方法,但作者打算自行实现。此外,还发现了PullToRefreshExpandableListActivity刷新问题,原因是数据源未更新。
摘要由CSDN通过智能技术生成

今天看了一个Android-PullToRefresh的开源项目,用于上拉、下拉刷新显示内容,下载项目源码https://github.com/fengcunhan/Android-PullToRefresh,里面包含三个文件夹

将库和例子代码导入到工程中,并将库添加到例子程序中,修改平台至无错误出现,浏览PullToRefreshListActivity代码,布局文件如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <!--
    The PullToRefreshListView replaces a standard ListView widget.
    -->
    <com.handmark.pulltorefresh.library.PullToRefreshListView
        xmlns:ptr="http://schemas.android.com/apk/res/com.handmark.pulltorefresh.sample"
        android:id="@+id/pull_refresh_list"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        ptr:mode="both"
        />
</LinearLayout>

在该项目的文档中说明了如果上拉下拉都使能时的设置,activity的代码很简单,只是一个列表显示

public class PullToRefreshListActivity extends ListActivity {

	static final int MENU_MANUAL_REFRESH = 0;
	static final int MENU_DISABLE_SCRO
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值