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

CIRCLE_INDICATOR样式中,条目从最后一页翻回到第一页,或从第一页翻回到最后一页下边指示点加载有延迟 #6

Closed
imexception opened this issue Jul 17, 2016 · 3 comments

Comments

@imexception
Copy link

1、createIndicator中应初始化指示点,默认第一个显示颜色,防止第一次时下边什么都不显示
if(i==0){
imageView.setImageResource(mIndicatorSelectedResId);
}else{
imageView.setImageResource(mIndicatorUnselectedResId);
}
2、onPageSelected中判断条件有误,当position==0或position==indicatorImages.size()+1时
for循环中都为false造成延迟加载,if中的判断条件应改为
i== (position - 1+indicatorImages.size())%indicatorImages.size()

@imexception
Copy link
Author

onPageSelected中使用for循环来改变指示点效率比较低,用一个标记位来记录上次的指示点,这样只用改变两个指示点就行了
声明局部变量用来记录上一次改变的指示点位置
private int lastPosition=1;
onPageSelected中的for循环替换为
indicatorImages.get((lastPosition - 1+indicatorImages.size())%indicatorImages.size()).setImageResource(mIndicatorUnselectedResId);
indicatorImages.get((position - 1+indicatorImages.size())%indicatorImages.size()).setImageResource(mIndicatorSelectedResId);
lastPosition=position;

@youth5201314
Copy link
Owner

ok,thank you!

@youth5201314
Copy link
Owner

已修改提交,非常感谢你的反馈!

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

2 participants