2016-09-23 88 views
0

其實我已經創建了一個使用回調ActionMode,是否可以在沒有CAB的情況下創建ActionMode回調?

mCallback = new ActionMode.Callback() 
     { 
      /** 
      * Invoked whenever the action mode is shown. This is invoked 
      * immediately after onCreateActionMode 
      */ 
      @Override 
      public boolean onPrepareActionMode(ActionMode mode, Menu menu) 
      { 
       return false; 
      } 

      /** Called when user exits action mode */ 
      @Override 
      public void onDestroyActionMode(ActionMode mode) 
      { 
       popupDismiss(); 
       mMode = null; 
       isActionMode = false; 
       CustomReaderView.this.clearFocus(); 
      } 

      /** 
      * This is called when the action mode is created. This is called by 
      * startActionMode() 
      */ 
      @Override 
      public boolean onCreateActionMode(ActionMode mode, Menu menu) 
      { 
       isActionMode = true; 
       mActionMode = mode; 

       return true; 
      } 

      /** This is called when an item in the context menu is selected */ 
      @Override 
      public boolean onActionItemClicked(ActionMode mode, MenuItem item) 
      { 
      } 
       return false; 
      } 

ActionMode,直到我不要按的ActionBar後退按鈕沒有得到onDestroyActionMode事件。

摘要

上首先觸摸ActionMode callback onCreateActionMode()應該沒有ActionBar & 上一個觸摸ActionMode callback onDestroyActionMode()應該被稱爲調用。

截圖

enter image description here

回答

0

試試這個onDestroyActionMode

mode.finish(); 
+0

'onDestroyActionMode'工作正常。我的問題「有沒有方法來創建沒有ActionBar的ActionMode?」。 – buzzingsilently

相關問題