Comments (2)
在ScrollableHelper的isRecyclerViewTop中添加StaggeredGridLayoutManager的时候的判断即可,项目中没有对这个类型进行判断:
private static boolean isRecyclerViewTop(RecyclerView recyclerView) {
if (recyclerView != null) {
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
int firstVisibleItemPosition = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition();
View childAt = recyclerView.getChildAt(0);
if (childAt == null) {
return true;
}
if (firstVisibleItemPosition == 0) {
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) childAt.getLayoutParams();
int topMargin = lp.topMargin;
int top = childAt.getTop();
if (top >= topMargin) {
return true;
}
}
}else if (layoutManager instanceof StaggeredGridLayoutManager) {
int[] firstVisibleItemPosition = ((StaggeredGridLayoutManager) layoutManager).findFirstVisibleItemPositions(null);
int first = firstVisibleItemPosition[0];
//说明适配器里没有数据已经是顶部了
View childAt = recyclerView.getChildAt(0);
if (childAt == null) {
return true;
}
//说明可见的是第一个
if (firstVisibleItemPosition.length > 0 && first == 0) {
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) childAt.getLayoutParams();
int topMargin = lp.topMargin;
int top = childAt.getTop();
if (top >= topMargin) {
return true;
}
}
}
}
return false;
}
from scrollablelayout.
遇到同样的问题如何解决
from scrollablelayout.
Related Issues (19)
- problem when rotating from landscape to portrait
- scrollablelayout.java 第210行这个if{...}块中把action设置为cancel调用super然后又把action set回去
- ViewPager切换到第二页时,无法下拉刷新 HOT 1
- 丶
- 切换ViewPager会出现不能刷新状况
- 无法下拉出顶部view
- 部分机型卡顿
- ScrollableLayout会导致其他View透明? HOT 1
- 想监听悬停控件已经悬停的状态 HOT 1
- 你好,有个问题想跟你请教一下。 HOT 4
- 和SmartRefreshLayout刷新嵌套下拉header部分有问题! HOT 1
- headview 的高度超过屏幕
- 如何在整个布局添加下拉刷新?
- 1. 偶现header还未顶上去,但是下方列表滚动上去了。2. 偶现,无法触发下拉刷新 HOT 3
- 滑动支持悬浮滑出屏幕吗 HOT 1
- setCurrentScrollableContainer(scrollableContainer);我用这种,而且底下是viewpager加两个fragment,里面是gridview。
- 希望可以加一个smoothScrollTo方法
- Collapse?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scrollablelayout.