We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
原来代码: recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @OverRide public void onGlobalLayout() { recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); int recyclerviewHeight = recyclerView.getHeight(); resizeHeight(recyclerviewHeight); } }); 以上代码在Android4.2以下Android设备会崩溃,建议修改为以下代码:recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(newViewTreeObserver.OnGlobalLayoutListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } int recyclerviewHeight = recyclerView.getHeight(); resizeHeight(recyclerviewHeight); } });
recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new
以上代码在Android4.2以下Android设备会崩溃,建议修改为以下代码:
ViewTreeObserver.OnGlobalLayoutListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } int recyclerviewHeight = recyclerView.getHeight(); resizeHeight(recyclerviewHeight); } });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原来代码:
recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new
ViewTreeObserver.OnGlobalLayoutListener() {@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@OverRide
public void onGlobalLayout() {
recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
int recyclerviewHeight = recyclerView.getHeight();
resizeHeight(recyclerviewHeight);
}
});
以上代码在Android4.2以下Android设备会崩溃,建议修改为以下代码:
recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(newViewTreeObserver.OnGlobalLayoutListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { recyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } int recyclerviewHeight = recyclerView.getHeight(); resizeHeight(recyclerviewHeight); } });
The text was updated successfully, but these errors were encountered: