java - How does offScreenPageLimit work for viewpager -


after go out of offscreenpagelimit, system call new view or page back?

the source code viewpager best place find answer.

in nutshell, viewpager keeps internal list of items (that respresent 'pages'). number of items in list based on the moffscreenpagelimit value. default it's set 1, can change calling setoffscreenpagelimit(int limit).

in (package protected) method populate(), viewpager gets populated pages, following code snippet located:

final int pagelimit = moffscreenpagelimit; final int startpos = math.max(0, mcuritem - pagelimit); final int n = madapter.getcount(); final int endpos = math.min(n-1, mcuritem + pagelimit); 

that determines bounds of dataset backs pageradapter , hence positions pages requested for.

non-existing pages created using (package protected) addnewitem() method, ends calling instatiateitem() on associated pageradapter. part implement, either directly or through 1 of concrete subclasses.

if changes along way, i.e. when backing dataset changed, or when setoffscreenpagelimit() called again different value, items may removed internal list, , call destroyitem() on pageradapter follows.

does answer question? if not, try bit more specific one-liner - should better you. :)


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -