GithubHelp home page GithubHelp logo

swipetoloadlayout's Issues

layout issue

用这个之后页面不能添加其他布局? 如页面上面固定了一个Linearlayout 下面在添加这个SwipeTOLoadLayout 这种布局的情况下 上面的固定区域会被覆盖看不到了 当然底部固定一个区域也是会被覆盖的

因为issue类别不一样,删除了你在另外一个issue中的留言。专门开一个issue讨论这个问题。

我测试过,没出现你说的问题。可以麻烦您能把布局文件贴出来么?
@hxingever

recyclerView无法拉出头部和底部

按照您的quick setup分别写了listView作为swipe_target和RecyclerView作为swipe_target的两个demo。listView正常可以拉出头部和底部。recyclerView无法拉出头部和底部。都是独立activity。
代码如下

<com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

    <com.gao.baseproject.RefreshHeaderView1
        android:layout_height="100dp"
        android:layout_width="match_parent" />

    <android.support.v7.widget.RecyclerView
        android:id="@id/swipe_target" />

    <com.gao.baseproject.LoadMoreView
        android:layout_height="100dp"
        android:layout_width="match_parent" />
</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>
swipeToLoadLayout = (SwipeToLoadLayout) findViewById(R.id.swipeToLoadLayout);
recyclerView = (RecyclerView) findViewById(R.id.swipe_target);
RecyclerView.LayoutManager layoutManager = null;
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(mMyAdpter);
swipeToLoadLayout.setOnRefreshListener(this);
swipeToLoadLayout.setOnLoadMoreListener(this);

swipeToLoadLayout.post(new Runnable() {
    @Override
    public void run() {
        swipeToLoadLayout.setRefreshing(true);
    }
});

关于loadmore的一点细节问题

当上拉加载完成后,能不能让RecyclerView向上滚动一点距离,让loadmore进来的数据露出一部分,这样能很直观看到数据已经加载进来了,而不是现在必须再手动滚动一次才能看到新数据

下拉刷新不弹回

最近遇到一个问题,初次进入首页,先自动刷新,在刷新过程中,瞬间切换到其他Fragment页面,然后返回到开始的页面,发现下拉刷新不弹回,每次都能测试出来。

后面突然还出现一次奔溃:
Device: Xiaomi HM NOTE 1LTE
Stack trace:
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131558426, class android.widget.ListView) with Adapter(class com.dsdyf.seller.ui.fragment.MyStoreFragment$4)]
at android.widget.ListView.layoutChildren(ListView.java:1555)
at android.widget.AbsListView.onLayout(AbsListView.java:2089)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.layoutChildren(SwipeToLoadLayout.java:846)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.updateScroll(SwipeToLoadLayout.java:1259)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.access$1600(SwipeToLoadLayout.java:28)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout$AutoScroller.run(SwipeToLoadLayout.java:1340)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5052)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

拷贝项目

你好
是这样的,我把你项目里的libary 拷贝到我的项目类库中,但是却在layout 文件 引用不到?
感谢!

first load GoogleCircleHookRefreshHeaderView issues

sometimes , first load GoogleCircleHookRefreshHeaderView ,pull to refresh, its only a arrow , I don't have any changes, maybe,it's a `bug.....

this is the layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            app:title="">



            <ImageView
                android:layout_width="100dp"
                android:layout_height="60dp"
                android:layout_centerInParent="true"
                android:layout_gravity="center"
                android:paddingBottom="5dp"
                android:src="@drawable/img_logo"/>


        </android.support.v7.widget.Toolbar>
    </android.support.design.widget.AppBarLayout>


    <com.aspsine.swipetoloadlayout.SwipeToLoadLayout
        android:id="@+id/swipeToLoadLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/appBarLayout"
        app:default_to_loading_more_scrolling_duration="500"
        app:load_more_complete_delay_duration="0"
        app:load_more_final_drag_offset="120dp"
        app:load_more_trigger_offset="88dp"
        app:refresh_final_drag_offset="150dp"
        app:refresh_trigger_offset="100dp"
        app:swipe_style="above"
        tools:context="com.ihongpan.activity.MainActivity"
        tools:showIn="@layout/fragment_subscribecenter">

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

        <android.support.v7.widget.RecyclerView
            android:id="@+id/swipe_target"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:clipToPadding="false"
            android:layoutDirection="inherit"/>

        <include
            android:id="@id/swipe_load_more_footer"
            layout="@layout/layout_google_hook_footer"/>


    </com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

</RelativeLayout> 

The content of the adapter has changed but ListView did not receive a notification

使用ViewPager+Fragment,SwipeToLoadLayout还没刷新完成,就快速切换到其它页面,很容易出现以下错误:
java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131558425, class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]

之前有说这样解决:
崩溃问题是更新了数据源之后没有调用notifyDataSetChanged()。比如如下使用方式就可能出现崩溃。

onSuccess(data){
mList.addAll(data);
swipeToLoadLayout.setRefreshing(false);
mAdapter.notifyDataSetChanged();
}
按照上面这样的用法,就会出现如上崩溃。
请修改为:

onSuccess(data){
swipeToLoadLayout.setRefreshing(false);
mList.addAll(data);
mAdapter.notifyDataSetChanged();
}

我是那么做的,但是还是不行。

下拉刷新头部进度条会不显示

这个库感觉挺不错的,但是有些细节可以改进下:
1.如果最外层嵌套的是LinearLayout,下拉刷新头部进度条会不显示。换成RelativeLayout就正常了;
2.ListView的头部与底部的分割线在有HeaderView和FootView的时候是不显示的;
3.加载完成更多,会弹回去,而不是直接显示数据,体验可以改进;
4.主动刷新会先显示下拉即可刷新,然后再显示正在刷新,如果改成直接正在刷新,体验会更好。

我包裹了自定义的 public class EasyRecyclerView extends FrameLayout出现下面的错误

系统异常退出11java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.canScrollVertically(int)' on a null object reference
Attempt to invoke virtual method 'boolean android.view.View.canScrollVertically(int)' on a null object reference
android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:1274)
android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1727)
com.aspsine.swipetoloadlayout.SwipeToLoadLayout.canChildScrollUp(SwipeToLoadLayout.java:927)
com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onCheckCanRefresh(SwipeToLoadLayout.java:897)
com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onTouchEvent(SwipeToLoadLayout.java:1060)

上拉加载更多

首先肯定你的下拉刷新真心很不错,但是在改动下拉刷新的时候,我在滚动事件中判断滚动到最后一个item时,自动加载更多,可是加上之后footer 中的一切iew都不显示,要是方便你Q我,那天让你改动过下拉动画那个就是我.谢谢,祝好!

你好,我有个疑问

你好,我有个疑问,我在自定义刷新头部的时候,实现 SwipeRefreshTrigger, SwipeTrigger这两个接口后,复写的那些方法是什么意思,比如onComplete(),是指刷新的时候请求数据完成的时候调用还是指什么?谢谢!

加载更多完成后

目前当加载更多完成后,footer消失,列表回弹footer的高度,到底部,加载的内容不能立即显示,能否实现列表不动,footer消失,加载的内容显示在footer的位置?

the swipe_target view not show complete

when the swipe_target view is a RelativeLayout who contains the two child view(recyclerview and LinearLayout) , then the recyclerview contains many item, the swipe_target only show one screen
the xml code
`
<com.duoniu.benfu.widget.layout.SwipeToLoadLayoutEmptySupport
android:id="@+id/swipeToLoadLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
app:swipe_style="classic">

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


<RelativeLayout
    android:id="@id/swipe_target"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.duoniu.benfu.widget.recyclerview.RecyclerViewEmptySupport
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </com.duoniu.benfu.widget.recyclerview.RecyclerViewEmptySupport>

    <include layout="@layout/empty_or_error"
        android:id="@+id/emptyView"
        android:visibility="gone"/>
</RelativeLayout>



<include
    android:id="@+id/swipe_load_more_footer"
    layout="@layout/layout_classic_footer"/>

</com.duoniu.benfu.widget.layout.SwipeToLoadLayoutEmptySupport>`

how can i solve it?

刷新效果不对

使用的这个类SwipToLoadLayoutGoogleCustomHeader
下拉刷新的时候 ,那个圆圈我建议是怎么出来就怎么回去,刷新完成了之后 会 慢慢缩回去,有时候会直接消失,刷新完成之后直接消失 这个问题请问怎么解决。

请教个 CoordinatorLayout 和 AppBarLayout 提早下拉刷新的问题

先看布局

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/main_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context=".android.core.activities.MainActivity">

        <include layout="@layout/include_app_bar_layout"/>

        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

        </FrameLayout>

    </android.support.design.widget.CoordinatorLayout>

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

上面 <include layout="@layout/include_app_bar_layout"/> 就是下面的 AppBarLayout。
中间的 FrameLayout 是主内容,是给Fragment的,Fragment的布局就是你的SwipeToLoadLayout

AppBarLayout

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:animateLayoutChanges="true"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/toolbar_height"
        android:layout_gravity="center"
        android:layout_marginEnd="@dimen/toolbar_margin"
        android:layout_marginLeft="@dimen/toolbar_margin"
        android:layout_marginRight="@dimen/toolbar_margin"
        android:layout_marginStart="@dimen/toolbar_margin"
        android:paddingTop="@dimen/toolbar_padding_top_basic"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/AppTheme.PopupOverlay">

        <include layout="@layout/include_toolbar_basic_light"/>
        <include layout="@layout/include_toolbar_basic_dark"/>

    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

SwipeToLoadLayout

<com.aspsine.swipetoloadlayout.SwipeToLoadLayout
    android:id="@+id/refresh_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--
    Don't add anything nor change the view id, SwipeToLoadLayout hard coded
    the view id, and only accept max 3 child views.
    -->

    <cn.com.cityweekend.android.utils.views.RefreshHeaderView
        android:id="@+id/swipe_refresh_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        app:indicator_color="@color/colorPrimary"/>

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

    <cn.com.cityweekend.android.utils.views.LoadMoreFooterView
        android:id="@+id/swipe_load_more_footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        app:indicator_color="@color/colorPrimary"/>

</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

再看截图
这是初始状态
screenshot_20160602-231022

上面蓝色区域整个都是 AppBarLayout,里面就是自己加了几个image和button。
蓝色区域下面就是你的SwipeToLoadLayout。

初始状态下下拉当然是没有问题的,如下图
screenshot_20160602-231013

当屏幕往上滚动的时候,AppBarLayout 整个会一起滚上去,然后往下滚动的时候,AppBarLayout 会马上出现,等 AppBarLayout 全部出现后,然后列表(RecyclerView)才开始滚动,这是 CoordinatorLayout 和 AppBarLayout 组合的效果。
问题就在于,如果滚动状态停在 AppBarLayout 出现一半的时间,松手,然后在往下滚动的时候,会出现下拉刷新,如下图
screenshot_20160602-231035

这样 AppBarLayout 就显示不全了,必须要先往上滚动一下,不松手,再往下滚动,就是正常的效果。

这就是我所谓的“提早下拉刷新的问题”,我稍后录个频帮助理解。

不支持ScrollView

Hi
我有一个很长的详情页,所以用了ScrollView,然后在底部有个评论列表,我用了你的这个layout,然后发现是空白的,我去掉了ScrollView,保留少量内容,可以看到你的layout可以正常工作,加上ScrollView,你的layout又空白了,我固定了你的layout的高度,看到里面有内容的,所以估计是高度被错误算成了0。

请问像我这样情况有没有办法?

setSwipeStyle()

可不可以分别设置头部与底部的STYLE;

比如头部的样式为STYLE.ABOV,而底部的样式为STYLE.SCALE

或者,同时存在整体STYLE、头部STYLE、底部STYLE。

试着改了一下源码,没有成功,因为设置中间部分的STYLE,这部分不知道该怎么设置它的STYLE。

dispatchTouchEvent

// swipeToRefresh -> finger up -> finger down if the status is still swipeToRefresh
// in onInterceptTouchEvent ACTION_DOWN event will stop the scroller
// if the event pass to the child view while ACTION_MOVE(condition is false)
// in onInterceptTouchEvent ACTION_MOVE the ACTION_UP or ACTION_CANCEL will not be
// passed to onInterceptTouchEvent and onTouchEvent. Instead It will be passed to
// child view's onTouchEvent. So we must deal this situation in dispatchTouchEvent

这个是啥意思?能用中文描述下吗?

报错boolean android.view.View.canScrollVertically(int)' on a null object reference请求帮忙

代码是按照demo里面的GoogleStyleFragment写的,activity布局是这个

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:id="@+id/myCoordinator"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:fitsSystemWindows="true">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="0dp">
        <FrameLayout
            android:id="@+id/toolbar_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:elevation="0dp"
            app:theme="@style/MyToolbarTheme"
            app:popupTheme="@style/ToolbarPopupTheme"
            app:contentInsetStart="0dp"
            app:layout_scrollFlags="scroll|enterAlways">
            <ImageView
                android:id="@+id/content_hamburger"
                style="@style/ImageView.Hamburger"
                android:src="@drawable/ic_add_blue"
                android:clickable="true"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#212121"
                android:text="易书"
                android:layout_gravity="center"
                android:textSize="@dimen/guillotine_item_text_size"/>
        </android.support.v7.widget.Toolbar>

        </FrameLayout>
    </android.support.design.widget.AppBarLayout>
    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:fillViewport="true"/>
    <android.support.v4.widget.NestedScrollView
        android:id="@+id/myScrollingContent"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

这是fragment的布局

<com.aspsine.swipetoloadlayout.SwipeToLoadLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:id="@+id/swipeToLoadLayout"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:background="#212121"
                                                 app:default_to_loading_more_scrolling_duration="500"
                                                 app:load_more_final_drag_offset="@dimen/load_more_final_offset_google"
                                                 app:load_more_trigger_offset="@dimen/load_more_trigger_offset_google"
                                                 app:refresh_final_drag_offset="@dimen/refresh_final_offset_google"
                                                 app:refresh_trigger_offset="@dimen/refresh_trigger_offset_google"
                                                 app:load_more_complete_delay_duration="0"
                                                 app:swipe_style="above">

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

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_note"
        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/refresh_footer" />

</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

报错为

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.canScrollVertically(int)' on a null object reference
                                                                   at android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
                                                                   at android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:1274)
                                                                   at android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1737)
                                                                   at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.canChildScrollUp(SwipeToLoadLayout.java:976)
                                                                   at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onCheckCanRefresh(SwipeToLoadLayout.java:1374)
                                                                   at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onTouchEvent(SwipeToLoadLayout.java:556)
                                                                   at android.view.View.dispatchTouchEvent(View.java:8471)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2399)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2092)
                                                                   at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.dispatchTouchEvent(SwipeToLoadLayout.java:453)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
                                                                   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2106)
                                                                   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2369)
                                                                   at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)
                                                                   at android.app.Activity.dispatchTouchEvent(Activity.java:2742)
                                                                   at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
                                                                   at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
                                                                   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2330)
                                                                   at android.view.View.dispatchPointerEvent(View.java:8666)
                                                                   at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123)
                                                                   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989)
                                                                   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
                                                                   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
                                                                   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
                                                                   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3680)
                                                                   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3571)
                                                                   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3737)
                                                                   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
                                                                   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
                                                                   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
                                                                at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java

初学Android开发,问题可能很简单,请海涵,但以我目前水平无法解决,望能帮忙看看,谢谢~

refreshHeader layout issue

很棒的代码。:D
但是我在使用的时候发现 定制下拉刷新的头部布局文件中,控件貌似必须要给出精确的宽度或者默认值,否则就显示不出来…譬如TextView 要么指定宽度,要么设置android:text=”xxx“ 否则下拉的时候就是空白的,但是功能都是正常的。

刷新状态的改变

SwipeToLoadLayout的刷新过程中是停留在顶部的, 可不可以加一种状态就是在刷新的时候 可以像其他刷新一样在刷新的过程中上划隐藏头部. 还望作者可以帮忙解决, 本来想自己改的但是没有搞定. 希望作者可以联系我 或者直接在这里回复我. [email protected].谢谢

好像不能嵌套CoordinatorLayout

<com.aspsine.swipetoloadlayout.SwipeToLoadLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/pl"
    android:layout_height="match_parent">

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/main_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/toolsssssbar"
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:background="#FFFFFF"
                android:gravity="center_vertical"
                android:orientation="vertical"
                app:layout_scrollFlags="scroll"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="点我" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="the best app" />
            </LinearLayout>

            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:background="#810e88" />

        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/vp_body"
            android:layout_width="match_parent"
            android:layout_height="800dp"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            >

        </android.support.v4.view.ViewPager>

    </android.support.design.widget.CoordinatorLayout>
</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

下拉报错

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.canScrollVertically(int)' on a null object reference
at android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
at android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:1274)
at android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1737)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.canChildScrollUp(SwipeToLoadLayout.java:976)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onCheckCanRefresh(SwipeToLoadLayout.java:1374)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.onTouchEvent(SwipeToLoadLayout.java:556)
at android.view.View.dispatchTouchEvent(View.java:9294)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2547)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2240)
at com.aspsine.swipetoloadlayout.SwipeToLoadLayout.dispatchTouchEvent(SwipeToLoadLayout.java:453)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737)
at android.app.Activity.dispatchTouchEvent(Activity.java:2765)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364)
at android.view.View.dispatchPointerEvent(View.java:9514)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4230)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4096)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3787)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3844)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5922)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5896)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5857)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6025)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5996)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6048)
at android.view.Ch

和RecyclerView一起使用碰到的问题

我自定义了刷新和加载的样式,但是不会显示出来,刷新和加载能成功,就是没有显示我自己的样式,我自定义的样式是继承TextView,我的RecyclerView的item中没有TextView,请问是这个原因吗?

ExpandableListView与ListView中,使用有问题

有一个使用ExpandableListView的界面,下拉刷新正常,但是滚到底部再往上滚动的时候会拉出header进行刷新,无法滚到界面头部。
同时,还发现在复杂ListView中,也有这个问题。
布局如下:

<?xml version="1.0" encoding="utf-8"?>
<com.aspsine.swipetoloadlayout.SwipeToLoadLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:id="@+id/expandable_list_activity_swipelayout"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:background="@color/white"
                                                 android:orientation="vertical"
                                                 app:swipe_style="classic">

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

    <LinearLayout
        android:id="@id/swipe_target"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal"
            android:padding="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="记录"
                android:textSize="13sp"/>

            <TextView
                android:id="@+id/diet_tool_total_eatnum_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:gravity="center"
                android:text="0"
                android:textSize="22sp"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:gravity="center"
                android:text=""
                android:textSize="13sp"/>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="10dp"
            android:background="@color/layout_bg"/>

        <ExpandableListView
            android:id="@+id/expandable_listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:childDivider="@color/transparent"
            android:divider="@color/layout_bg"
            android:dividerHeight="10dp"
            android:groupIndicator="@null"/>
    </LinearLayout>

</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

您好 rcyclerView的问题

按照您的quick setup分别写了listView作为swipe_target和RecyclerView作为swipe_target的两个demo。listView正常可以拉出头部和底部。recyclerView无法拉出头部和底部。代码如下
<com.aspsine.swipetoloadlayout.SwipeToLoadLayout>
<com.gao.baseproject.RefreshHeaderView1
android:layout_width="match_parent"
android:layout_height="100dp"/>
<android.support.v7.widget.RecyclerView
android:id="@id/swipe_target"/>
<com.gao.baseproject.LoadMoreView
android:layout_width="match_parent"
android:layout_height="100dp"/>
</com.aspsine.swipetoloadlayout.SwipeToLoadLayout>

   swipeToLoadLayout = (SwipeToLoadLayout) findViewById(R.id.swipeToLoadLayout);
    recyclerView = (RecyclerView) findViewById(R.id.swipe_target);
    RecyclerView.LayoutManager layoutManager = null;
    layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(mMyAdpter);
    swipeToLoadLayout.setOnRefreshListener(this);
    swipeToLoadLayout.setOnLoadMoreListener(this);

    swipeToLoadLayout.post(new Runnable() {
        @Override
        public void run() {
            swipeToLoadLayout.setRefreshing(true);
        }
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.