java - Android 中的 fragment 事务错误不适用

标签 java android eclipse android-5.0-lollipop

您好,我将主题切换为“@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/

相关文章:

android - Gradle项目同步完成,代理中有一些错误

eclipse - Eclipse Juno 中的旧式选项卡?

java - 如何使用java定位并点击jubula中的web元素?

java - UDP发送和接收

java - JSONException : at jsonData of type java. lang.String 无法转换为 JSONArray

java - 如何通过应用程序的内部浏览器发送设备信息

java - 在java中用 '\\'替换 '\'字符串

android - 如何在对话框中自定义android中CheckMark颜色的颜色。 : android

android - 如何在 Retrofit 2.0.0 beta 1 中获取简单的 JSON 对象?

java - 错误: "Some projects cannot be imported because they already exist in the workspace" when i tried to import SWT to Eclipse