使用api 4.4.2编译ActionBarSherlock中的错误

时间:2014-06-26 14:33:35

标签: android actionbarsherlock

我在ActionBarSherlock

中有这段代码
@Override
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) 
{
    if (super.onRequestSendAccessibilityEvent(child, event)) {
        // Add a record for ourselves as well.
        AccessibilityEvent record = AccessibilityEvent.obtain();
        onInitializeAccessibilityEvent(record);
        // Populate with the text of the requesting child.
        child.dispatchPopulateAccessibilityEvent(record);
        event.appendRecord(record);
        return true;
    }
    return false;
}

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        info.setEnabled(selectedView.isEnabled());
    }
}

@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setScrollable(isScrollableForAccessibility());
    View selectedView = getSelectedView();
    if (selectedView != null) {
        event.setEnabled(selectedView.isEnabled());
    }
    event.setCurrentItemIndex(getSelectedItemPosition());
    event.setFromIndex(getFirstVisiblePosition());
    event.setToIndex(getLastVisiblePosition());
    event.setItemCount(getCount());
}

我在super.onInitializeAccessibilityEvent(event)上遇到编译错误;和其他一些方法。

有谁知道为什么会这样?

谢谢!

1 个答案:

答案 0 :(得分:1)

投诉是您的android:minSdkVersion设置为8,该代码指的是在API级别14之前未添加的类,方法或字段。

如果您正在尝试修改ActionBarSherlock并自行编译,您可以添加相应的代码来处理此问题(检查Build.VERSION.SDK_INT)并添加@TargetApi()注释以阻止Lint抱怨。< / p>