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
CoverFlowLayoutManger中mSlectPositon计算存在bug private void onSelectedCallBack() { mSelectPosition = Math.round (mOffsetAll / getIntervalDistance()); mSelectPosition = Math.abs(mSelectPosition % getItemCount()); if (mSelectedListener != null && mSelectPosition != mLastSelectPosition) { mSelectedListener.onItemSelected(mSelectPosition); } mLastSelectPosition = mSelectPosition; }
当mSelectPositon为负数时,会出现位置对不上,比如我有5个条目,当mSelectPosition为-6,Math.abs(mSelectPosition % getItemCount())计算结果为1,但事实对应的条目应该是4,当mSelectPosition为负数时正确的位置计算应该为应为 mSelectPosition = 条目个数和(list.size())+mSelectPosition % getItemCount()
The text was updated successfully, but these errors were encountered:
list.size())+mSelectPosition % getItemCount()
牛逼,但是还有一种偶现情况 为负数的时候,计算完mSelectPosition =getItemCount(),此时应该置位0,还需要再优化。
Sorry, something went wrong.
/** * 计算当前选中位置,并回调 */ private void onSelectedCallBack() { mSelectPosition = Math.round(mOffsetAll / getIntervalDistance()); Log.e("mSelectPosition", "mSelectPosition = " + mSelectPosition); if (mSelectPosition < 0) { mSelectPosition = getItemCount() + mSelectPosition % getItemCount(); } else { mSelectPosition = Math.abs(mSelectPosition % getItemCount()); } if (mSelectPosition == getItemCount()) {// 偶现相等 Log.e("mSelectPosition", "偶现相等 "); mSelectPosition = 0; } if (mSelectedListener != null && mSelectPosition != mLastSelectPosition) { mSelectedListener.onItemSelected(mSelectPosition); } mLastSelectPosition = mSelectPosition; }
No branches or pull requests
CoverFlowLayoutManger中mSlectPositon计算存在bug
private void onSelectedCallBack() {
mSelectPosition = Math.round (mOffsetAll / getIntervalDistance());
mSelectPosition = Math.abs(mSelectPosition % getItemCount());
if (mSelectedListener != null && mSelectPosition != mLastSelectPosition) {
mSelectedListener.onItemSelected(mSelectPosition);
}
mLastSelectPosition = mSelectPosition;
}
当mSelectPositon为负数时,会出现位置对不上,比如我有5个条目,当mSelectPosition为-6,Math.abs(mSelectPosition % getItemCount())计算结果为1,但事实对应的条目应该是4,当mSelectPosition为负数时正确的位置计算应该为应为
mSelectPosition = 条目个数和(list.size())+mSelectPosition % getItemCount()
The text was updated successfully, but these errors were encountered: