ViewPager and FragmentPagerAdapter with Fragments (not support library)

不打扰是莪最后的温柔 提交于 2020-01-13 11:09:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!