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
在onresume时,回调生命周期:Lifecycle.State.STARTED,所以下面的判定会造成轮播图无法恢复滚动,这个问题出现的时机是当轮播图已经加载了,切换到别的页面时暂停这个轮播图,再回来这个页面无法恢复滚动。这个轮播图是用在recycleview列表的,第二段代码是轮播图的实现代码。 现在是暂停后,需要我自己在onresume时调用startLoopNow方法才能恢复播放,因为这个方法没有进行判定生命周期。 /**
第二段代码 holder.bannerView .registerLifecycleObserver(lifecycle) .setIndicatorHeight(AutoSizeUtils.pt2px(context, 4f)) .setCanLoop(!isStopLoops) .setIndicatorSliderWidth(tipWidth) .setIndicatorStyle(IndicatorStyle.ROUND_RECT) .setIndicatorMargin(0, 0, 0, AutoSizeUtils.pt2px(context, 12f)) .stopLoopWhenDetachedFromWindow(false) .setIndicatorSliderColor(Color.parseColor("#80FFFFFF"), Color.parseColor("#FFFFFF")) .setAdapter(MainItemBannerTestAdapter(context)).create(lists[position].banner)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在onresume时,回调生命周期:Lifecycle.State.STARTED,所以下面的判定会造成轮播图无法恢复滚动,这个问题出现的时机是当轮播图已经加载了,切换到别的页面时暂停这个轮播图,再回来这个页面无法恢复滚动。这个轮播图是用在recycleview列表的,第二段代码是轮播图的实现代码。
现在是暂停后,需要我自己在onresume时调用startLoopNow方法才能恢复播放,因为这个方法没有进行判定生命周期。
/**
*/
public void startLoop() {
if (!isLooping
&& isAutoPlay()
&& mBannerPagerAdapter != null
&& mBannerPagerAdapter.getListSize() > 1
&& isAttachedToWindow() && (lifecycleRegistry == null
|| lifecycleRegistry.getCurrentState() == Lifecycle.State.RESUMED
|| lifecycleRegistry.getCurrentState() == Lifecycle.State.CREATED)) {
mHandler.postDelayed(mRunnable, getInterval());
isLooping = true;
}}
第二段代码
holder.bannerView
.registerLifecycleObserver(lifecycle)
.setIndicatorHeight(AutoSizeUtils.pt2px(context, 4f))
.setCanLoop(!isStopLoops)
.setIndicatorSliderWidth(tipWidth)
.setIndicatorStyle(IndicatorStyle.ROUND_RECT)
.setIndicatorMargin(0, 0, 0, AutoSizeUtils.pt2px(context, 12f))
.stopLoopWhenDetachedFromWindow(false)
.setIndicatorSliderColor(Color.parseColor("#80FFFFFF"), Color.parseColor("#FFFFFF"))
.setAdapter(MainItemBannerTestAdapter(context)).create(lists[position].banner)
The text was updated successfully, but these errors were encountered: