Using FragmentStatePagerAdapter WITHOUT support library(在没有支持库的情况下使用 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在没有支持库的情况下使用 FragmentStatePagerAdapter


- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01