在 Fragments 之后是否有其他人在覆盖 onAttach()
时遇到问题
从 android-support-v4.jar 切换到 ActionBarSherlock
图书馆?
e, g.
@ Override
public void onAttach (Activity activity) {
super. onAttach (activity);
}
对于 ActionBarSherlock ,编译器会报错:
The method onAttach (Activity) of type ... Fragment must override or
Implement a super-type method
但是对于 android-support-v4.jar 文件,它工作正常。
*******更新 em>*****
我也尝试过使用:
@Override
onAttach(FragmentActivity activity){
super.onAttach(activity);
...
}
它基本上提示同样的事情:
The method onAttach (FragmentActivity) of type ... must override or
Implement a super-type method
最佳答案
确保将 Java 编译器合规级别设置为 1.6 属性->"Java Compiler"->"Compiler compliance level"
您需要安装 JRE1.6 或 JRE1.7。
关于android - ActionbarSherlock 混淆了 Fragment 的 onAttach() 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9212372/