Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the Android ICS API have a native equivalent to ViewPager support lib?

I have searched a bit around for a pager for fragment , I develop on ICS API.

I know about ViewPager and all the support libs for earlier version but i don't get why I should use a support library consider the fact that I use the lastest version of the api and don't plan to support earlier version.

Do I have to write the "ViewPager" myself or is there something i didn't see in the api.

like image 991
eephyne Avatar asked Mar 31 '12 17:03

eephyne


1 Answers

Does the Android ICS API have a native equivalent to ViewPager support lib?

No.

I know about ViewPager and all the support libs for earlier version but i don't get why I should use a support library consider the fact that I use the lastest version of the api and don't plan to support earlier version.

The Android Support package is not only for backports of newer APIs. It is also for other classes that, for whatever reason, are not being added to the SDK, such as ViewPager and its supporting classes.

Do I have to write the "ViewPager" myself or is there something i didn't see in the api.

You are welcome to write your own implementation of a view paging component. Savvy programmers would use the one in the Android Support package, since it is already written and (mostly) debugged.

UPDATE: Note that ViewPager works just fine with pages that are:

  • API Level 11+ native fragments
  • Android Support backported fragments
  • arbitrary Views

For the first case, you need the v13 version of the support JAR, which contains v13 versions of the FragmentPagerAdapter and FragmentStatePagerAdapter classes.

like image 97
CommonsWare Avatar answered Oct 29 '22 13:10

CommonsWare