51193

Android ViewPager skip page animation

Question:

I have a ViewPager with multiple Fragments.

I would like to skip some of the pages inside it. I have done the logic for it. It looks like this:

protected List<Fragment> pages; public void nextSlide() { int currentItem = getPager().getCurrentItem(); int pagesCount = mPagerAdapter.getCount(); while (++currentItem < pagesCount) { Fragment page = pages.get(currentItem); if (page.isEnabled()) { break; } } if (currentItem < pagesCount) { getPager().setCurrentItem(currentItem); } }

But I have problem with animation between 2 pages (with one or more skipped between that). It 'slides' to the proper page, but the animation skips through all 'disabled' pages.

How to handle that, to remove disabled pages from this animation?

Thanks

Answer1:

there is a setCurrentItems(int,boolean) that has the page number and weather to smooth scroll (animate) or not

Recommend

  • Passing a custom model into a Umbraco Partial View and getting object casting error
  • Declaring functions inside arguments [duplicate]
  • Use jquery to target classes that are added dynamically?
  • How to set a boolean flag to collapse/expand a row with ng-repeat
  • How to get minimal jQuery slideshow to slide properly?
  • c# Set value to a DataRow automatically
  • 'NSInvalidArgumentException', reason: '-[AVPlayerItem duration]: unrecognized selecto
  • Add business days to the new date in jquery
  • Why are not all images showing up in this slider?
  • How to send an array of Flex checkboxes to a mysql server?
  • ViewPager : Navigating Back to Parent Fragment From Child Fragment Closes The Application
  • Play video in reverse using AVPlayer and Swift on IOS 9
  • Outlook Add-on to Add Text to Mail Body
  • how I get the current visible fragment from view pager Adapter..?
  • How to find control with in repeater on button click event and repeater is placed with in gridview i
  • Using AVPlayer for streaming is slow
  • Android Wear: WearableActivity with FragmentPagerAdapter
  • Error handling in WPF PasswordBox
  • Pulling Columns from Excel
  • How to save digital signature of received mail
  • Can I display google adwords (AdView) in javafx on android
  • Validaiting emails with Net.Mail MailAddress
  • sending/ receiving email in Java
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Cannot Parse HTML Data Using Android / JSOUP
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • JTable with a ScrollPane misbehaving
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • unknown Exception android
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • failed to connect to specific WiFi in android programmatically
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?