Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

UltraViewPagerView#setAdapter(PagerAdapter) 可能会失效 #121

Open
BenWong927 opened this issue Feb 12, 2019 · 0 comments
Open

UltraViewPagerView#setAdapter(PagerAdapter) 可能会失效 #121

BenWong927 opened this issue Feb 12, 2019 · 0 comments

Comments

@BenWong927
Copy link

在用UltraViewPager实现banner放在vlayout中时会出现banner不能够显示的问题,具体的代码片段为
final UltraViewPager viewPager = new UltraViewPager(context); final PagerAdapter pagerAdapter = new PagerAdapter(this, viewPool); viewPager.setAdapter(pagerAdapter); .... viewPager.setAdapter(null); ... viewPager.setAdapter(pagerAdapter);
这样就会出现pagerAdapter没有被设置到viewPager,出现这种用法的情况就是在参考VLayoutActivity.java中#onCreate的if (BANNER_LAYOUT)部分,将其中的ViewPager替换为UltraViewPager,并且将onBindViewHolder中的viewPager.setAdapter(new PagerAdapter(this, viewPool));改为viewPager.setAdapter(mAdapter);mAdapter为全局的。
这个问题通过每次都new一个adapter可以解决,但这样做不是很好,故提这个issue。感谢您阅读此issue!

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

No branches or pull requests

1 participant