问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/21283468/viewpager-and-fragmentpageradapter-with-fragments-not-support-library