解决android SwipeRefreshLayout recyclerview 不能下拉
2015-11-19 14:43
246 查看
http://stackoverflow.com/questions/25178329/recyclerview-and-swiperefreshlayout
23down vote | write the following code in addOnScrollListenerof the RecyclerView Like this: recyclerView.setOnScrollListener(new 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); } }); |
相关文章推荐
- Android Canvas 说明
- Android控件之CheckBox、RadioButton
- android定制 Launcher
- android 5.0 新特性
- Android音频系统之音频框架
- android四大组件之Service 播放音乐
- 【Android】长按连续触发事件的实现方法
- Android编程实现仿心跳动画效果的方法
- android录制声音写入文件
- 关于android应用的toolbar(actionbar)不能填满布局解决
- Android在SDCard创建目录_卸载应用同时删除工程创建的文件
- Android 4.4前后版本读取图库图片和拍照完美解决方案
- android自定义状态栏的颜色
- Android 工程师如何快速学会web前段
- button设置点击更改背景图片
- 如何创建上下文菜单
- Android 设置Activity窗体 不显示标题和全屏显示
- Android Animation实现元素在屏幕上按照指定轨迹运动,以及出现NullPointerException的解决方案
- Android编程之界面跳动提示动画效果实现方法
- Android 工程师如何快速学会web前段