WebSettingsCompat
public
class
WebSettingsCompat
extends Object
| java.lang.Object | |
| ↳ | androidx.webkit.WebSettingsCompat |
Compatibility version of WebSettings
Summary
Public methods | |
|---|---|
static
int
|
getDisabledActionModeMenuItems(WebSettings webSettings)
Gets the action mode menu items that are disabled, expressed in an integer field flag. |
static
boolean
|
getOffscreenPreRaster(WebSettings webSettings)
Gets whether this WebView should raster tiles when it is offscreen but attached to a window. |
static
boolean
|
getSafeBrowsingEnabled(WebSettings webSettings)
Gets whether Safe Browsing is enabled. |
static
void
|
setDisabledActionModeMenuItems(WebSettings webSettings, int menuItems)
Disables the action mode menu items according to |
static
void
|
setOffscreenPreRaster(WebSettings webSettings, boolean enabled)
Sets whether this WebView should raster tiles when it is offscreen but attached to a window. |
static
void
|
setSafeBrowsingEnabled(WebSettings webSettings, boolean enabled)
Sets whether Safe Browsing is enabled. |
Inherited methods | |
|---|---|
Public methods
getDisabledActionModeMenuItems
public static int getDisabledActionModeMenuItems (WebSettings webSettings)
Gets the action mode menu items that are disabled, expressed in an integer field flag.
The default value is WebSettings.MENU_ITEM_NONE
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS.
| Parameters | |
|---|---|
webSettings |
WebSettings |
| Returns | |
|---|---|
int |
all the disabled menu item flags combined with bitwise OR. |
getOffscreenPreRaster
public static boolean getOffscreenPreRaster (WebSettings webSettings)
Gets whether this WebView should raster tiles when it is offscreen but attached to a window.
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.OFF_SCREEN_PRERASTER.
| Parameters | |
|---|---|
webSettings |
WebSettings |
| Returns | |
|---|---|
boolean |
true if this WebView will raster tiles when it is
offscreen but attached to a window.
|
getSafeBrowsingEnabled
public static boolean getSafeBrowsingEnabled (WebSettings webSettings)
Gets whether Safe Browsing is enabled.
See setSafeBrowsingEnabled(WebSettings, boolean).
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.SAFE_BROWSING_ENABLE.
| Parameters | |
|---|---|
webSettings |
WebSettings |
| Returns | |
|---|---|
boolean |
true if Safe Browsing is enabled and false otherwise.
|
setDisabledActionModeMenuItems
public static void setDisabledActionModeMenuItems (WebSettings webSettings, int menuItems)
Disables the action mode menu items according to menuItems flag.
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS.
| Parameters | |
|---|---|
webSettings |
WebSettings |
menuItems |
int: an integer field flag for the menu items to be disabled.
|
setOffscreenPreRaster
public static void setOffscreenPreRaster (WebSettings webSettings, boolean enabled)
Sets whether this WebView should raster tiles when it is
offscreen but attached to a window. Turning this on can avoid
rendering artifacts when animating an offscreen WebView on-screen.
Offscreen WebViews in this mode use more memory. The default value is
false.
Please follow these guidelines to limit memory usage:
- WebView size should be not be larger than the device screen size.
- Limit use of this mode to a small number of WebViews. Use it for visible WebViews and WebViews about to be animated to visible.
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.OFF_SCREEN_PRERASTER.
| Parameters | |
|---|---|
webSettings |
WebSettings |
enabled |
boolean |
setSafeBrowsingEnabled
public static void setSafeBrowsingEnabled (WebSettings webSettings, boolean enabled)
Sets whether Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links.
Safe Browsing can be disabled for all WebViews using a manifest tag (read general Safe Browsing info). The manifest tag has a lower precedence than this API.
Safe Browsing is enabled by default for devices which support it.
This method should only be called if
WebViewFeature.isFeatureSupported(String)
returns true for WebViewFeature.SAFE_BROWSING_ENABLE.
| Parameters | |
|---|---|
webSettings |
WebSettings |
enabled |
boolean: Whether Safe Browsing is enabled.
|
Interfaces
Classes
- SafeBrowsingResponseCompat
- ServiceWorkerClientCompat
- ServiceWorkerControllerCompat
- ServiceWorkerWebSettingsCompat
- WebMessageCompat
- WebMessagePortCompat
- WebMessagePortCompat.WebMessageCallbackCompat
- WebResourceErrorCompat
- WebResourceRequestCompat
- WebSettingsCompat
- WebViewClientCompat
- WebViewCompat
- WebViewFeature