getChildFragmentManager()和支持库 [英] getChildFragmentManager() and support libraries

查看:687
本文介绍了getChildFragmentManager()和支持库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用的是 getChildFragmentManager()在一个应用程序,正在编制对API级别19,用最小的SDK设置为14。

getChildFragmentManager()被引入API 17,这样的设备API级别运行14,15,或16将抛出一个的NoSuchMethodError 时,该方法被调用。

我也期待通过所有有关此问题的其他StackOverflow的问题,但他们都不来回答这个问题:有没有办法让 getChildFragmentManager()方法在设备上pre-API级17的工作?如果是这样,怎么样?

似乎该方法不被包括在任一或v4的v13的支持库。我试图干净的构建既V4和V13支持库,但是这似乎并没有解决这个问题。

解决方案
  

有没有什么办法让getChildFragmentManager()方法来工作的设备pre-API级17?如果是这样,怎么样?

使用片段的反向移植从Android支持包( Android的支持 - v4.jar android.support.v4.app.Fragment )。

  

似乎该方法不被包括在任一或v4的v13的支持库。

<打击>是的,这就是,在 FragmentActivity 活动的基类,你需要才能使用使用该片段的backport。

这是从反向移植的片段类,用于管理片段的子片段。

  

我试图干净的构建既V4和V13支持库,但是这似乎并没有解决这个问题。

要么你没有更改为<击> FragmentActivity 片段反向移植,或您的支持库JAR是旧的。 这里是演示如何使用的<击> 示例项目FragmentActivity 片段反向移植及其 getChildFragmentManager()

I am using the getChildFragmentManager() in an app that is compiling against API level 19, with the minimum SDK set to 14.

getChildFragmentManager() was introduced in API 17, so devices running at API levels 14, 15, or 16 will throw a NoSuchMethodError when the method is called.

I did look through all the other StackOverflow questions regarding this issue, but none of them seem to answer this question: is there any way to get the getChildFragmentManager() method to work on devices pre-API level 17? If so, how?

The method does not seem to be included in either the v4 or v13 support libraries. I have tried clean builds with both v4 and v13 support libraries, but that does not seem to solve the issue.

解决方案

is there any way to get the getChildFragmentManager() method to work on devices pre-API level 17? If so, how?

Use the backport of fragments from the Android Support package (android-support-v4.jar, android.support.v4.app.Fragment).

The method does not seem to be included in either the v4 or v13 support libraries.

Yes, it is, on FragmentActivity, the Activity base class you need to use in order to use the fragments backport.

It is on the Fragment class from the backport, for managing child fragments of that fragment.

I have tried clean builds with both v4 and v13 support libraries, but that does not seem to solve the issue.

Either you did not change to FragmentActivity the Fragment backport, or your support library JARs are old. Here is a sample project demonstrating the use of FragmentActivity the Fragment backport and its getChildFragmentManager().

这篇关于getChildFragmentManager()和支持库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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