webview - How to override web view text selection menu in android -
the basic android's web text selection menu shown in image attached below. has options copy, share, select all, web search.
i want on ride menus , want them own menu list "mark colour", "mark imp" etc. around of questions available context menu on stack overflow. of question relate context menu not giving result expected. want menu below image
when perform selection android monitor shows view creation form viewroot like
d/viewrootimpl: #1 mview = android.widget.popupwindow$popupdecorview{648898f v.e...... ......i. 0,0-0,0} d/viewrootimpl: #1 mview = android.widget.popupwindow$popupdecorview{a66541c v.e...... ......i. 0,0-0,0} d/viewrootimpl: msg_resized_report: ci=rect(0, 0 - 0, 0) vi=rect(0, 0 - 0, 0) or=1 d/viewrootimpl: msg_resized_report: ci=rect(0, 0 - 0, 0) vi=rect(0, 0 - 0, 0) or=1
how achieve such implementation?
i gone through https://github.com/naoak/webviewmarker not getting proper result.
what have done yet?
i extend webview of android , want make support minimum sdk 19. when perform long press got long press event can't such menus creation api calls.
you need overwrite action menus of activity
more info can read :https://developer.android.com/guide/topics/ui/menus.html
how overwrite:
@override public void onactionmodestarted(android.view.actionmode mode) { mode.getmenu().clear(); menu menus = mode.getmenu(); mode.getmenuinflater().inflate(r.menu.highlight,menus); super.onactionmodestarted(mode); }
highlight
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/impclick" android:title="mark important" /> <item android:id="@+id/colorclick" android:title="mark color" /> </menu>
Comments
Post a Comment