Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ViewPager and FragmentPagerAdapter with Fragments (not support library)

I would like to use fragments (not support fragments) with a view pager, I understand the v13 library has support for fragments but I don't want to import the whole library for my project.

Does anyone know how to find a way round this? e.g an implementation of the FragmentPagerAdapter with Fragments.

Thanks

like image 907
AndroidEnthusiast Avatar asked Dec 07 '22 03:12

AndroidEnthusiast


1 Answers

ViewPager is a Java class. It can be found in the android-support-v4 and android-support-v13 libraries. android-support-v13 is a superset of android-support-v4, adding in some classes that are only relevant if your android:minSdkVersion is 13 or higher, such as the native fragment version of FragmentPagerAdapter.

My guess is that you think that you need both android-support-v4 and android-support-v13, which is incorrect -- you only need android-support-v13.

You are, of course, welcome to roll your own PagerAdapter implementation that happens to use native fragments.

like image 157
CommonsWare Avatar answered Dec 10 '22 13:12

CommonsWare