<bdo id='LxvoB'></bdo><ul id='LxvoB'></ul>
  • <i id='LxvoB'><tr id='LxvoB'><dt id='LxvoB'><q id='LxvoB'><span id='LxvoB'><b id='LxvoB'><form id='LxvoB'><ins id='LxvoB'></ins><ul id='LxvoB'></ul><sub id='LxvoB'></sub></form><legend id='LxvoB'></legend><bdo id='LxvoB'><pre id='LxvoB'><center id='LxvoB'></center></pre></bdo></b><th id='LxvoB'></th></span></q></dt></tr></i><div id='LxvoB'><tfoot id='LxvoB'></tfoot><dl id='LxvoB'><fieldset id='LxvoB'></fieldset></dl></div>

        <legend id='LxvoB'><style id='LxvoB'><dir id='LxvoB'><q id='LxvoB'></q></dir></style></legend>

      1. <tfoot id='LxvoB'></tfoot>

        <small id='LxvoB'></small><noframes id='LxvoB'>

        Android.app Fragments 与 android.support.v4.app 使用 ViewPager?

        时间:2023-10-04

            <bdo id='raBZz'></bdo><ul id='raBZz'></ul>
          • <small id='raBZz'></small><noframes id='raBZz'>

                  <tbody id='raBZz'></tbody>
                  <tfoot id='raBZz'></tfoot>

                  <legend id='raBZz'><style id='raBZz'><dir id='raBZz'><q id='raBZz'></q></dir></style></legend>
                1. <i id='raBZz'><tr id='raBZz'><dt id='raBZz'><q id='raBZz'><span id='raBZz'><b id='raBZz'><form id='raBZz'><ins id='raBZz'></ins><ul id='raBZz'></ul><sub id='raBZz'></sub></form><legend id='raBZz'></legend><bdo id='raBZz'><pre id='raBZz'><center id='raBZz'></center></pre></bdo></b><th id='raBZz'></th></span></q></dt></tr></i><div id='raBZz'><tfoot id='raBZz'></tfoot><dl id='raBZz'><fieldset id='raBZz'></fieldset></dl></div>
                2. 本文介绍了Android.app Fragments 与 android.support.v4.app 使用 ViewPager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个关于 Android 支持库、片段以及作为具体示例的 ViewPager 类的问题.我的目的是创建一个与 Android 开发者网站 (http://developer.android.com/training/animation/screen-slide.html 或 http://developer.android.com/training/implementing-navigation/lateral.html).查看他们的代码,我注意到他们使用了 android.support.v4.app 库,根据我的研究,这是访问 ViewPager 类的唯一方法.

                  I have a question regarding the Android Support Libraries, Fragments, and as a specific example, the ViewPager class. My intention is to create an app with similar functionality to the sample provided on the Android Developer website (http://developer.android.com/training/animation/screen-slide.html or http://developer.android.com/training/implementing-navigation/lateral.html). Looking into their code, I've noticed they utilize the android.support.v4.app library, which from my research is the only way to access the ViewPager class.

                  在我的情况下,我对向后兼容性没有兴趣.最低 API 级别为 14(冰淇淋三明治),构建目标为 4.2 Jelly Bean.在最简单的形式中,我的应用程序的性能与我在 Android 开发网站上链接的第二个演示完全相同 - 只需在三个选项卡之间滑动,每个选项卡都有内容.

                  In my situation, I have no interest in backward compatibility. The minimum API level is 14 (Ice Cream Sandwich) and the build target is 4.2 Jelly Bean. In it's simplest form, my app performs exactly as does the second demo I linked on the Android dev website - just swiping between three tabs with content in each.

                  我读过的所有文章/帖子/答案似乎都非常支持 v4 支持库.现在我的问题虽然冗长,但:

                  All of the articles/posts/answers I've read seem to heavily favor the v4 support library. Now for my, albeit long-winded, question(s):

                  1. 构建我的应用程序的最佳方式是什么 - 使用 android.support.v4.app,从而使用 SupportFragments,或者使用 android.app - 为什么?

                  1. What's the best way to structure my application - using android.support.v4.app, and thereby using SupportFragments, or to use the Fragments provided in android.app - and why?

                  如果来自 android.app 的片段是可行的方法,那么接近 ViewPagers 的最佳方式是什么?

                  If Fragments from android.app are the way to go, what is the optimal way to approach ViewPagers?

                  如果 SupportFragments 最适合该任务,我估计它们具有与另一个相同的功能 - 那么将它们放在 android.app 中的目的是什么?

                  If SupportFragments are best-suited to the task, I would estimate that they possess the same functionality as the other - so what's the purpose of having them at all inside android.app?

                  希望有更清楚理解的人可以给我一点澄清,因为我很困惑......

                  Hopefully someone with a clearer understanding can give me a bit of clarification because I'm boggled...

                  推荐答案

                  您可以将 ViewPagerandroid.app 包中的原生片段与 android.app 包中的适配器一起使用一个 href="http://developer.android.com/reference/android/support/v13/app/package-summary.html" rel="noreferrer">android.support.v13.app 包.为此,您必须使用 v13 支持 jar.

                  You can use ViewPager with native fragments from the android.app package with the adapters from the android.support.v13.app package. You have to use the v13 support jar for that.

                  有两个版本的适配器可以与 ViewPager 一起使用,v4 包中的那些用于支持片段, 中的那些v13 带有原生片段.

                  There are two versions of the adapters that work with ViewPager, the ones in the v4 package are meant to be used with support fragments, the ones in v13 with native fragments.

                  现在有两个 Fragment 实现的原因是历史性的:android.app 包中的 Fragment 仅在 Android 3 中针对平板电脑引入,并且创建了支持库以将 Fragment 带到运行较旧的手机上版本.在 Android 4 上,两者都有.

                  The reason why there are now two fragment implementations is historical: Fragments in the android.app package were introduced with Android 3 for tablets only and the support library was created to bring fragments to phones running older versions. On Android 4 you have both.

                  根据我自己的经验,我建议使用支持片段,即使是在为 Android 4 开发时也是如此.以下是一些原因:片段或支持片段?

                  From my own experience I would recommend using support fragments, even when developing for Android 4. Here are some reasons: Fragment or Support Fragment?

                  这篇关于Android.app Fragments 与 android.support.v4.app 使用 ViewPager?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以将视图寻呼机与视图一起使用(而不是片段) 下一篇:在 ViewPager 中用另一个 Fragment 替换一个 Fragment

                  相关文章

                  <small id='JYA7G'></small><noframes id='JYA7G'>

                3. <tfoot id='JYA7G'></tfoot><legend id='JYA7G'><style id='JYA7G'><dir id='JYA7G'><q id='JYA7G'></q></dir></style></legend>
                    <bdo id='JYA7G'></bdo><ul id='JYA7G'></ul>

                  1. <i id='JYA7G'><tr id='JYA7G'><dt id='JYA7G'><q id='JYA7G'><span id='JYA7G'><b id='JYA7G'><form id='JYA7G'><ins id='JYA7G'></ins><ul id='JYA7G'></ul><sub id='JYA7G'></sub></form><legend id='JYA7G'></legend><bdo id='JYA7G'><pre id='JYA7G'><center id='JYA7G'></center></pre></bdo></b><th id='JYA7G'></th></span></q></dt></tr></i><div id='JYA7G'><tfoot id='JYA7G'></tfoot><dl id='JYA7G'><fieldset id='JYA7G'></fieldset></dl></div>