getSherlockActivity().startActionMode返回null

use*_*493 2 android actionbarsherlock android-actionbar contextual-action-bar

我正在尝试在4.2设备上启动操作模式,但结果为null.我不确定它是一个sherlock问题,因为原生呼叫是失败的.

任何帮助将不胜感激.

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id{
   CustomCell cell = (CustomCell) view.getTag();
   if (cell == null) {
        return false;
    }
    mGridView.setChocieMode(LibraryGridView.CHOICE_MODE_MULTIPLE);

    if (mActionMode != null) {
        return false;
    }
   mActionMode = getSherlockActivity().startActionMode(mActionCallback);
   cell.setSelected(true);
   return true;
}
Run Code Online (Sandbox Code Playgroud)

use*_*493 9

原来,ActionMode.Callback中的onCreateActionMode返回false,将返回值设置为true解决了问题