在没有支持库的情况下使用 FragmentStatePagerAdapter

编程入门 行业动态 更新时间:2024-10-27 22:21:19
本文介绍了在没有支持库的情况下使用 FragmentStatePagerAdapter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道是否可以在没有支持库的情况下使用 FragmentStatePagerAdapter 类或其等效类?

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 {...

推荐答案

我想你已经阅读了 ViewPager docs,但以防万一:

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

该课程目前处于早期设计和开发阶段.这API 可能会在以后的兼容性库更新中发生变化,编译时需要更改应用程序的源代码针对较新的版本.

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.

我最初也对为什么 PagerAdapter 类不是 android.app.* 命名空间的一部分感到困惑.由于它们仍在改进中,因此它们已包含在支持库中,以便这些库可以在引入更改时频繁更新(AOSP 更新不那么方便,因此发生的频率要低得多).看来,一旦 Android 团队最终确定了 ViewPager 及其所有相关类,它们将成为 AOSP 的一部分.甚至 ViewPager 类本身仍然是 V4 支持库的一部分.所以你想要的应该在不久的将来成为可能...... :)

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 ... :)

更多推荐

在没有支持库的情况下使用 FragmentStatePagerAdapter

本文发布于:2023-07-11 08:55:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1093495.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:情况下   FragmentStatePagerAdapter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!