您好,我将主题切换为“@android:style/Theme.Material.Light.DarkActionBar”.. API 21。
除了添加或替换 fragment 之外,一切正常。
transaction.add(R.id.frame, new OneFragment());
在 Eclipse 中,错误提示..“类型 fragment 事务中的方法 add(int,fragment) 不适用于参数 (int,OneFragment)”
在我尝试更改主题之前,这是有效的。 我的应用程序与新主题完美运行,但我在 fragment 部分遇到错误,如上所述。
谢谢
最佳答案
"The method add(int, fragment) in the type fragment transaction is not applicable for the arguments (int,OneFragment)"
这通常是由于 Fragment
的导入之间存在一些不一致造成的。例如,当您使用 native FragmentManager
并且 Fragment
子类的导入来自支持库(或反之亦然)时,就会发生这种情况
关于java - Android 中的 fragment 事务错误不适用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29133485/