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

onViewAttachedToWindow() not called #6

Closed
arjs1000 opened this issue Mar 11, 2015 · 4 comments
Closed

onViewAttachedToWindow() not called #6

arjs1000 opened this issue Mar 11, 2015 · 4 comments
Milestone

Comments

@arjs1000
Copy link

Hi,

I am trying to update the ViewHolder just as the View appears on the Window from the Adapter. However, I am unable to do so, as the onViewAttachedToWindow() callback is not triggered as views are recycled and displayed in the pager.

Please state the best way to achieve this. Using onBindViewHolder() callback, the layout can be changed when not visible on screen. Essentially I have a View Animator holding several ImageViews for a slideshow. My dilemma is: I only wish to add Images to the layout when the view is becoming visible in the RecyclerViewPager.

Moreover, is there a way to limit the number of Views created in the pager? I'm looking for a method similar to the standard ViewPager's setOffscreenPageLimit(int pages)

Thanks,
Arjun

@lsjwzh
Copy link
Owner

lsjwzh commented Mar 12, 2015

May be you can use ' view.getViewTreeObserver().addOnGlobalLayoutListener(tempListener);
' to implement same function like 'onViewAttachedToWindow'.

And i will take a look to find some solution about 'onViewAttachedToWindow' and 'setOffscreenPageLimit'.

@lsjwzh lsjwzh added this to the 0.6 milestone Mar 12, 2015
@lsjwzh lsjwzh closed this as completed Jun 12, 2015
@lsjwzh lsjwzh modified the milestones: 1.1, 0.6 Jun 12, 2015
@lsjwzh
Copy link
Owner

lsjwzh commented Jun 12, 2015

Feature Request: setOffscreenPageLimit

@lsjwzh lsjwzh reopened this Jun 12, 2015
@litao0621
Copy link

+1

@lsjwzh lsjwzh closed this as completed Dec 7, 2015
@gbero
Copy link

gbero commented Mar 25, 2016

any updates on this ?

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

No branches or pull requests

5 participants
@lsjwzh @gbero @litao0621 @arjs1000 and others