SwipeToLoadLayout使用注意事项

SwipeToLoadLayout 使用时需要注意的事项. 作为下拉刷新,和上拉加载的三方jar包 是挺好用的.今天我使用时,发现有个需要注意的地方

下面是在布局中使用SwipeToLoadLayout,

<com.aspsine.swipetoloadlayout.SwipeToLoadLayout
    android:id="@+id/swipeToLoadLayoutAdd"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <include
        android:id="@id/swipe_refresh_header"
        layout="@layout/layout_refresh_head_view" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/swipe_target"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"
        android:clipToPadding="false"/>

    <include
        android:id="@id/swipe_load_more_footer"
        layout="@layout/layout_load_more_foot_view" />
</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

注意看,这里的三个控件,都有id. 区别就在控件的id这里,id不可以自己设定,需要和SwipeToLoadLayout jar包中给的id一致,如果不,会报错.

报错如下:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.canScrollVertically(int)' on a null object reference


在SwipeToLoadLayout jar包中 给的ID我贴出来.

this.mHeaderView = this.findViewById(id.swipe_refresh_header);
this.mTargetView = this.findViewById(id.swipe_target);
this.mFooterView = this.findViewById(id.swipe_load_more_footer);
这三个是jar中,给的id. 需要保持一致.谢谢观看,欢迎转载


  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值