1

android-support-v4.jar 切换ActionBarSherlock 库后,是否还有其他人onAttach()Fragments中覆盖问题?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文件可以正常工作。

** * ****更新* ** * *

我也尝试使用:

@Override
onAttach(FragmentActivity activity){
  super.onAttach(activity);
  ...
}

它抱怨基本相同的事情:

The method onAttach (FragmentActivity) of type ... must override or 
    Implement a super-type method
4

2 回答 2

1

确保将 Java 编译器合规级别设置为 1.6 属性->“Java 编译器”->“编译器合规级别”

您需要安装 JRE1.6 或 JRE1.7。

于 2012-08-28T12:09:47.903 回答
0

这不是我的答案,它来自评论中的 Selvin,但他没有将其作为答案发布,因此很难找到。

你需要使用:

@Override
public void onAttach(SupportActivity activity)
于 2012-02-17T16:12:59.800 回答