Android 2.1中的ActionMode.Callback

时间:2015-01-08 17:44:42

标签: android

我想在API 8中使用ActionMode.Callback。我尝试将startActionMode更改为startSupportActionMode等,但它仍然无效。错误为Cannot resolve method 'startSupportActionMode(android.view.ActionMode.CallBack)'

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                getActivity().startSupportActionMode(modeCallBack);
                return true;
            }
        });

    }

    private ActionMode.Callback modeCallBack = new ActionMode.Callback() {

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            mode.setTitle("Options");
            mode.getMenuInflater().inflate(R.menu.menu_msg, menu);
            return true;
        }

        ...
    };

0 个答案:

没有答案