WebViewClient.ShouldOverrideKeyEvent(WebView, KeyEvent) Method

Definition

Give the host application a chance to handle the key event synchronously.

[Android.Runtime.Register("shouldOverrideKeyEvent", "(Landroid/webkit/WebView;Landroid/view/KeyEvent;)Z", "GetShouldOverrideKeyEvent_Landroid_webkit_WebView_Landroid_view_KeyEvent_Handler")]
public virtual bool ShouldOverrideKeyEvent (Android.Webkit.WebView? view, Android.Views.KeyEvent? e);
[<Android.Runtime.Register("shouldOverrideKeyEvent", "(Landroid/webkit/WebView;Landroid/view/KeyEvent;)Z", "GetShouldOverrideKeyEvent_Landroid_webkit_WebView_Landroid_view_KeyEvent_Handler")>]
abstract member ShouldOverrideKeyEvent : Android.Webkit.WebView * Android.Views.KeyEvent -> bool
override this.ShouldOverrideKeyEvent : Android.Webkit.WebView * Android.Views.KeyEvent -> bool

Parameters

view
WebView

The WebView that is initiating the callback.

e
KeyEvent

The key event.

Returns

true if the host application wants to handle the key event itself, otherwise return false

Attributes

Remarks

Give the host application a chance to handle the key event synchronously. e.g. menu shortcut key events need to be filtered this way. If return true, WebView will not handle the key event. If return false, WebView will always handle the key event, so none of the super in the view chain will see the key event. The default behavior returns false.

Java documentation for android.webkit.WebViewClient.shouldOverrideKeyEvent(android.webkit.WebView, android.view.KeyEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to