Skip to content
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

代码片段显示奔溃 #20

Open
DarrenHkk opened this issue Sep 5, 2018 · 6 comments
Open

代码片段显示奔溃 #20

DarrenHkk opened this issue Sep 5, 2018 · 6 comments

Comments

@DarrenHkk
Copy link

加载代码片段有时候空格很大,有时候会奔溃 private int getTextInLineLenInRange(CharSequence text, int start, int end, int rs, int re, Paint paint) {
int e = rs;
if (rs > end) {
return end;
}
while (paint.measureText(text, start, e) < mWidth - PADDING * 2) {
e++;
if (e > end || e > re) {
break;
}
}
return e - 1;
} 这个方法会出现数组越界的异常奔溃,请问怎么弄

@zzhoujay
Copy link
Owner

zzhoujay commented Sep 5, 2018

可以提供下出现问题的源文本吗?我周末复现解决下

@DarrenHkk
Copy link
Author

你可以弄一个长一点的代码片段,在recycleView里面加载,多滑动几次,代码片段的那个item的高度就会变化,有时候就会报这个错

@DarrenHkk
Copy link
Author

随便什么代码片段都可以的,在recycleView里面滑动

@zzhoujay
Copy link
Owner

zzhoujay commented Sep 9, 2018

这个项目最近看来问题比较多,后面我找个时间重构下

@Juslt
Copy link

Juslt commented Nov 20, 2020

请问这个问题是怎么解决的,我最近也遇到了

加载代码片段有时候空格很大,有时候会奔溃 private int getTextInLineLenInRange(CharSequence text, int start, int end, int rs, int re, Paint paint) {
int e = rs;
if (rs > end) {
return end;
}
while (paint.measureText(text, start, e) < mWidth - PADDING * 2) {
e++;
if (e > end || e > re) {
break;
}
}
return e - 1;
} 这个方法会出现数组越界的异常奔溃,请问怎么弄

@yang1256149685
Copy link

请问解决了嘛,同问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants