ViewPager,兼容包和冰淇淋三明治 [英] ViewPager, compatibility package and ice cream sandwich

查看:202
本文介绍了ViewPager,兼容包和冰淇淋三明治的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了Ice Cream Sandwich的Andr​​oid应用程序。我想在我的应用程序能够使用ViewPager,但我似乎不能这样做,因为它说,使用兼容包时,它才可用。在这里,我有一个问题,因为我不希望使用兼容包,因为如果我这样做,我将无法使用preferencesFragment(它不是兼容包内使用,但是是非常重要的,我的应用程序) 。现在,我觉得我卡住了。我的问题是,是否有人知道某种解决办法,我可以使用,才能够使用这个ViewPager或某物类似吧。也许,如果他们把它的冰淇淋三明治可用。我会AP preciate任何建议。 THX!

I am building an android application for Ice Cream Sandwich. I want in my application to be able to use the ViewPager, but I can't seem to do that because it says it is only available when using the compatibility package. Here I have a problem, because I don't want to use the compatibility package because if I do that I wont be able to use PreferencesFragment (it is not available within the compatibility package, but is very important for my application). Now I feel like I'm stuck. My question is, does someone knows some kind of workaround i can use, to be able to use this ViewPager or sth similar to it. And maybe if they made it available in the ice cream sandwich.. I would appreciate any suggestion. Thx!

推荐答案

您可以使用它。添加兼容性,使用ViewPager。

You can use it. Add compatibility, use ViewPager.

不要使用FragmentPagerAdapter或FragmentStatePagerAdapter,因为他们期望从兼容包碎片。

Do not use FragmentPagerAdapter or FragmentStatePagerAdapter, cause they expect fragments from compatibility package.

从冰淇淋扩展PagerAdapter或简单复制FragmentPagerAdapter或FragmentStatePagerAdapter之一,并在他们里面使用的片段。

Extend PagerAdapter or simply copy one of the FragmentPagerAdapter or FragmentStatePagerAdapter and use inside them fragments from ice cream.

源链接
<一href=\"https://github.com/android/platform_frameworks_support/blob/master/v13/java/android/support/v13/app/FragmentPagerAdapter.java\" rel=\"nofollow\">https://github.com/android/platform_frameworks_support/blob/master/v13/java/android/support/v13/app/FragmentPagerAdapter.java
<一href=\"https://github.com/android/platform_frameworks_support/blob/master/v13/java/android/support/v13/app/FragmentStatePagerAdapter.java\" rel=\"nofollow\">https://github.com/android/platform_frameworks_support/blob/master/v13/java/android/support/v13/app/FragmentStatePagerAdapter.java

这篇关于ViewPager,兼容包和冰淇淋三明治的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆