Adding custom menu for webview text selection.

Hi,

I am trying to add a custom menu for in webview's text selection. I am able to achieve the same in ios but in android, I will have to do it in mainAcitivity. I don't want to add to mainActivity as it will add the custom menu for all the webviews in the app, and I want only for one of the webview.

Note:
I am developing an app which has more than one webview and I want custom text-selection menu only for one webview.

Thanks in advance

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Based on your description, you have different needs for your webview, but now, you just achieve one custom webview for your project, If so, you can create different custom webviews for your different needs. In the android platform, please achieve the different custom renderer for the different custom webview.

  • yes I have separate custom renderer for webviews, but onActionModeStarted can be overridden only in mainActivity right? How can I override onActionModeStarted in customrenderers.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can use use diferent custom menus in the same onActionModeStarted, For example. You have two custom menus, When you appear a webview, then load the first custom menu, you can set the scecond custom menu to invisable. To control status of custom menu, you can use MessagingCenter to achieve it.

  • manjubagademanjubagade Member ✭✭

    share me some samples code

  • manjubagademanjubagade Member ✭✭

    using MessagingCenter

Sign In or Register to comment.