Hey I'm having the same issue, did you ever find a solution?

On Monday, February 22, 2016 at 6:18:38 AM UTC-5, Vishal Kumar Singh wrote:
>
> Hi,
>
> I had customized the Contextual Action mode appearing on text selection in 
> webview. In android M its not working, how to get top toolbar behaviour in 
> Android M or customize the new contextual menu appearing in Android M.??
>
> public class CustomWebView extends WebView {
>
>     private ActionMode.Callback mActionModeCallback;
>
>     public CustomWebView(Context context) {
>         super(context);
>     }
>
>     public CustomWebView(Context context, AttributeSet attrs) {
>         super(context, attrs);
>     }
>
>     @Override
>     public ActionMode startActionMode(ActionMode.Callback callback) {
>         mActionModeCallback = new CustomActionModeCallback();
>         return startActionMode(mActionModeCallback);
>     }
>
>     private class CustomActionModeCallback implements ActionMode.Callback {
>
>         @Override
>         public boolean onCreateActionMode(ActionMode mode, Menu menu) {
>             MenuInflater inflater = mode.getMenuInflater();
>             inflater.inflate(R.menu.context_menu, menu);
>             return true;
>         }
>
>         @Override
>         public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
>             return false;
>         }
>
>         @Override
>         public boolean onActionItemClicked(ActionMode mode, MenuItem item) 
> {
>             switch (item.getItemId()) {
>                 case R.id.copy:
>                     Toast.makeText(getContext(), "Copy", 
> Toast.LENGTH_SHORT).show();
>                     mode.finish(); // Action picked, so close the CAB
>                     return true;
>                 case R.id.paste:
>                     Toast.makeText(getContext(), "Paste", 
> Toast.LENGTH_SHORT).show();
>                     mode.finish();
>                     return true;
>                 // Create a case for every item
>                 default:
>                     mode.finish();
>                     return false;
>             }
>         }
>
>         @Override
>         public void onDestroyActionMode(ActionMode mode) {
>             clearFocus();
>         }
>     }
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/8aae65d2-00d8-41aa-b5d6-7101503ebdb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to