简体   繁体   中英

Using FragmentStatePagerAdapter WITHOUT support library

I would like to know is it possible to use the class FragmentStatePagerAdapter or its equivalent without the support library?

I know how to use native fragments in place of those from the support library and many other classes have their similar equivalents, but I can't find what should be used instead of this class.

I basically want to extend it for using it in my adapter like this

public class ImageAdapter extends FragmentStatePagerAdapter {...

I presume you've read the ViewPager docs , but just in case:

This class is currently under early design and development. The API will likely change in later updates of the compatibility library, requiring changes to the source code of apps when they are compiled against the newer version.

I too was initially baffled as to why the PagerAdapter classes were not a part of the android.app.* namespace. As they are still undergoing refinement, they have been included in the support libraries so that those libraries can be updated frequently as changes are introduced (AOSP updates are far less convenient and thus occur on a far less frequent basis). It seems that once the Android team gives final shape to the ViewPager and all its related classes, they will become a part of the AOSP. Even the ViewPager class itself is still a part of the V4 support library. So what you want should be possible in the near future ... :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM