swiperefreshlayout

SwipeRefreshLayout with NestedScrollView and LinearLayout

痴心易碎 提交于 2019-12-03 06:28:51
问题 <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"> <!--<include--> <!--android:id="@+id/app_bar"--> <!--layout="@layout/app_bar" />--> <android.support.design.widget.CoordinatorLayout android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout

IllegalArgumentException: pointerIndex out of range from SwipeRefreshLayout

♀尐吖头ヾ 提交于 2019-12-03 04:50:42
问题 I've been getting some of these IllegalArgumentException: pointerIndex out of range crashes on crashlytics and I don't understand what's happening. It's not limited to one android build or device, it happens on 5.0.1, 4.4.4, 4.4.2, 4.0.4, 2.3.6 all on various devices. Below is the full log output for more context. java.lang.RuntimeException: Unable to destroy activity {com.mypackage.myapp/com.mypackage.myapp.MyListActivity}: java.lang.IllegalArgumentException: pointerIndex out of range at

How to disable “pull to refresh” action and use only indicator?

瘦欲@ 提交于 2019-12-03 04:09:26
I enabled "pull to refresh" to my project using the SwipeRefreshLayout . When I move down, appear the loading indicator (material design style). I know, it must so work, but I want to disable this function, and start refreshing by click some button and use SwipeRefreshLayout loading indicator. How I can to do this? nhasan From the documentation: If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view. So to show the animation: swiperefreshLayout.setEnabled(true);

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I met a lot of issues related with my problem but nobody I found wanted the behaviour I'm looking for. I want a view pager with tabs and app bar, when the contained fragments are scrollable and are scrolled (toward bottom), I want the app bar to disapear but leave the tabs, when scrolled toward top, to re-apear. some of these fragments contain a SwipeToRefresh Layout (sometimes it causes problems). I tried a lot of configurations that always leave something wrong. for now I don't have the collapsing effect (it's always hidden) <?xml version=

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

蓝咒 提交于 2019-12-03 00:58:32
I met a lot of issues related with my problem but nobody I found wanted the behaviour I'm looking for. I want a view pager with tabs and app bar, when the contained fragments are scrollable and are scrolled (toward bottom), I want the app bar to disapear but leave the tabs, when scrolled toward top, to re-apear. some of these fragments contain a SwipeToRefresh Layout (sometimes it causes problems). I tried a lot of configurations that always leave something wrong. for now I don't have the collapsing effect (it's always hidden) <?xml version="1.0" encoding="utf-8"?> <android.support.design

IllegalArgumentException: pointerIndex out of range from SwipeRefreshLayout

為{幸葍}努か 提交于 2019-12-02 18:04:09
I've been getting some of these IllegalArgumentException: pointerIndex out of range crashes on crashlytics and I don't understand what's happening. It's not limited to one android build or device, it happens on 5.0.1, 4.4.4, 4.4.2, 4.0.4, 2.3.6 all on various devices. Below is the full log output for more context. java.lang.RuntimeException: Unable to destroy activity {com.mypackage.myapp/com.mypackage.myapp.MyListActivity}: java.lang.IllegalArgumentException: pointerIndex out of range at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3671) at android.app.ActivityThread

Android SwipeRefreshLayout RecyclerView

戏子无情 提交于 2019-12-02 13:58:49
SwiperRefreshLayout 介绍 1、在坚直滑动时想要刷新页面可以用SwipeRefreshLayout来实现。它通过设置OnRefreshListener来监听界面的滑动从而实现刷新。也可以通过一些方法来设置SwipeRefreshLayout是否可以刷新。如setRefreshing(true),展开刷新动画。setRefreshing(false)取消刷新动画。setEnable(true)下拉刷新将不可用。 2、使用这个布局要想达到刷新的目的,需要在这个布局里包裹可以滑动的子控件,如ListView等,并且只能有一个控件。 主要方法 1、isRefreshing() 判断当前的状态是否是刷新状态。 2、setColorSchemeResources(int... colorResIds) 设置下拉进度条的颜色主题,参数为可变参数,并且是资源id,可以设置多种不同的颜色,每转一圈就显示一种颜色。 3、setOnRefreshListener(SwiperRefreshLayout.OnRefreshListener listener) 设置监听,需要重写onRefresh()方法,顶部下拉时会调用这个方法,在里面实现请求数据的逻辑,设置下拉进度条消失等。 4、setProgressBackgroundColorSchemeResource(int colorRes

SwipeRefreshLayout和RecyclerView实现下拉刷新和加载更多(当总数据不够一页,也进行了处理)

ε祈祈猫儿з 提交于 2019-12-02 13:57:59
前言:利用SwipeRefreshLayout和RecyclerView来实现下拉刷新和加载更多,有很多的例子,但普遍都存在一个问题,当总的数据不够一屏时,FooterView也显示了,如果直接隐藏FooterView,加载更多时FooterView又不显示了,捣鼓了一阵子后,总算完美的解决了,所以记录一下,同时为了方便使用,进行了一些简单的封装。 直接进入主题,关于SwipeRefreshLayout和RecyclerView的一些基本介绍,就不在这里累述,不了解的童鞋,上网查一下吧! 一、封装自己的RefreshLayout控件 为什么要封装?为了使用方便;更为了Activity简单(MVP模式);因为Adapter的数据源类型不确定,所以采用泛型来实现。 java类和xml布局如下图 仔细的童鞋,已经发现了java类继承的是LinearLayout(xml根节点),为什么不用直接继承SwipeRefreshLayout(xml根节点)呢?其实一开始也是直接已SwipeRefreshLayout为根节点的,直接以SwipeRefreshLayout为根节点,运行后发现下拉刷新的颜色无法修改(swipeRefreshLayout.setColorSchemeColors(int color)无效),而且SwipeRefreshLayout.setRefreshing(false

SwipeRefreshLayout 、RecyclerView 与 CoordinatorLayout 嵌套刷新滑动冲突的解决办法

∥☆過路亽.° 提交于 2019-12-02 13:56:58
SwipeRefreshLayout 与 CoordinatorLayout 嵌套刷新 1.设置 mSwipeRefreshLayout.setOnRefreshListener(this); 2. 动态设置SwipeRefreshLayout的是否可以刷新 setEnable(boolean isEnable); 3. 设置SwipRefreshLayout刷新图标的位置 setProgressViewOffset(true, -20, 100); 4. 监听 AppBarLayout Offset 变化,动态设置 SwipeRefreshLayout 是否可用 appBarLayout = (AppBarLayout) findViewById(R.id.appbar_layout); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (verticalOffset >= 0) { mSwipeRefreshLayout.setEnabled(true); } else {

解决SwipeRefreshLayout与RecyclerView滑动冲突问题

牧云@^-^@ 提交于 2019-12-02 13:56:47
背景:高版本的编译环境中,SwipeRefreshLayout和RecyclerView并不存在滑动冲突问题,而我恰恰手里有个target是22的项目,当我按照正常的逻辑写完界面后,使用app发现滑动整个列表时两个控件发生冲突,本着快速解决上线任务的原则,直接百度. 网上的完美解决方案如下 : RecyclerView.OnScrollListener(){ @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { int topRowVerticalPosition = (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop(); swipeRefreshLayout.setEnabled(topRowVerticalPosition >= 0); } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } });