现在的位置: 首页 > 综合 > 正文

The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the

2018年03月31日 ⁄ 综合 ⁄ 共 511字 ⁄ 字号 评论关闭


The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)


今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题  import android.app.Fragment;
import android.app.FragmentManager;   其实我应该使用的是  import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;   然后自己查看了一下API二者差别还是蛮大的   import android.app.Fragment 只能在API版本大于11的时候使用   而不包含getFragmentManager() 和
getSupportFragmentManager()  两个方法的   虽然在代码这样写不会报错的  但是  replace(int, Fragment, String)执行的时候会一直出现错误   提示上面那个错误信息

抱歉!评论已关闭.