【问题标题】:PagerAdapter doesn't have the getPageWidth() method, as documentedPagerAdapter 没有 getPageWidth() 方法,如文档所述
【发布时间】:2012-11-05 02:06:14
【问题描述】:

使用 sdk 版本 8 和 android-support-v4,我正在尝试实现一个同时显示多个页面的 PagerAdapter。

在网上找到了一些好的建议,表明实现此目的的最佳方法是覆盖 PagerAdapter 上的 getPageWidth(int) 方法。

http://commonsware.com/blog/2012/08/20/multiple-view-viewpager-options.html

但是,PagerAdapter 在 android-support-v4.jar 中没有该方法。我不知道为什么,因为 androids 自己的文档确实证实了该方法的存在。

http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html#getPageWidth(int)

问题当然是如果该方法不存在,那么重写它是没有意义的,因为它永远不会被调用。

有什么想法吗?

【问题讨论】:

    标签: android android-viewpager


    【解决方案1】:

    您的 JAR 可能已过期。确保您使用的是最新的 Android 支持包。或者,从the sample project that I linked to in the blog post 获取 JAR。

    【讨论】:

    • 不要忘记将相同的库添加到其他引用的库中!像我一样:D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 2021-07-29
    • 2020-02-06
    • 1970-01-01
    • 2020-12-29
    • 2022-12-24
    • 1970-01-01
    相关资源
    最近更新 更多