-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find a crash #110
Comments
java.lang.ClassCastException: android.support.v7.widget.LinearLayoutManager cannot be cast to android.support.v7.widget.StaggeredGridLayoutManager |
public void getRecyclerViewInfo(RecyclerView.LayoutManager layoutManager) {
|
GridLayoutManager extends LinearLayoutManager,所以会那么写,能给个有问题的demo么,没看懂为什么会出错。 |
之前指出的地方没有问题,可能导致崩溃原因和情景是 |
android.support.v7.widget.LinearLayoutManager cannot be cast to android.support.v7.widget.StaggeredGridLayoutManager
XRefreshContentView:
public void getRecyclerViewInfo(LayoutManager layoutManager) {
int[] lastPositions = null;
if(this.layoutManagerType == null) {
if(layoutManager instanceof GridLayoutManager) {
this.layoutManagerType = XRefreshContentView.LAYOUT_MANAGER_TYPE.GRID;
} else if(layoutManager instanceof LinearLayoutManager) {
this.layoutManagerType = XRefreshContentView.LAYOUT_MANAGER_TYPE.LINEAR;
} else {
if(!(layoutManager instanceof StaggeredGridLayoutManager)) {
throw new RuntimeException("Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
}
//TODO no break ?????????????????????????????????????????????????????????????
case 2:
this.mLastVisibleItemPosition = ((LinearLayoutManager)layoutManager).findLastVisibleItemPosition();
this.mFirstVisibleItem = ((LinearLayoutManager)layoutManager).findFirstVisibleItemPosition();
break;
case 3:
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager)layoutManager;
if(lastPositions == null) {
lastPositions = new int[staggeredGridLayoutManager.getSpanCount()];
}
The text was updated successfully, but these errors were encountered: