public class WebSettingsClassic extends WebSettings
Modifier and Type | Class and Description |
---|---|
static class |
WebSettingsClassic.AutoFillProfile |
WebSettings.LayoutAlgorithm, WebSettings.PluginState, WebSettings.RenderPriority, WebSettings.TextSize, WebSettings.ZoomDensity
LOAD_CACHE_ELSE_NETWORK, LOAD_CACHE_ONLY, LOAD_DEFAULT, LOAD_NO_CACHE, LOAD_NORMAL
Modifier and Type | Method and Description |
---|---|
boolean |
enableSmoothTransition()
Gets whether the WebView enables smooth transition while panning or
zooming.
|
boolean |
forceUserScalable()
Returns whether the viewport metatag can disable zooming
|
boolean |
getAllowContentAccess()
Gets whether this WebView supports content URL access.
|
boolean |
getAllowFileAccess()
Gets whether this WebView supports file access.
|
boolean |
getAllowFileAccessFromFileURLs()
Gets whether JavaScript running in the context of a file scheme URL can
access content from other file scheme URLs.
|
boolean |
getAllowUniversalAccessFromFileURLs()
Gets whether JavaScript running in the context of a file scheme URL can
access content from any origin.
|
boolean |
getAutoFillEnabled() |
WebSettingsClassic.AutoFillProfile |
getAutoFillProfile() |
boolean |
getBlockNetworkImage()
Gets whether the WebView does not load image resources from the network.
|
boolean |
getBlockNetworkLoads()
Gets whether the WebView does not load any resources from the network.
|
boolean |
getBuiltInZoomControls()
Gets whether the zoom mechanisms built into WebView are being used.
|
int |
getCacheMode()
Gets the current setting for overriding the cache mode.
|
String |
getCursiveFontFamily()
Gets the cursive font family name.
|
boolean |
getDatabaseEnabled()
Gets whether the database storage API is enabled.
|
String |
getDatabasePath()
Gets the path to where database storage API databases are saved.
|
int |
getDefaultFixedFontSize()
Gets the default fixed font size.
|
int |
getDefaultFontSize()
Gets the default font size.
|
String |
getDefaultTextEncodingName()
Gets the default text encoding name.
|
static String |
getDefaultUserAgentForLocale(Context context,
Locale locale)
Returns the default User-Agent used by a WebView.
|
WebSettings.ZoomDensity |
getDefaultZoom()
Gets the default zoom density of the page.
|
boolean |
getDisplayZoomControls()
Gets whether the WebView displays on-screen zoom controls when using
the built-in zoom mechanisms.
|
boolean |
getDomStorageEnabled()
Gets whether the DOM Storage APIs are enabled.
|
int |
getDoubleTapZoom()
Get the double-tap zoom of the page in percent.
|
String |
getFantasyFontFamily()
Gets the fantasy font family name.
|
String |
getFixedFontFamily()
Gets the fixed font family name.
|
boolean |
getHardwareAccelSkiaEnabled() |
boolean |
getJavaScriptCanOpenWindowsAutomatically()
Gets whether JavaScript can open windows automatically.
|
boolean |
getJavaScriptEnabled()
Gets whether JavaScript is enabled.
|
WebSettings.LayoutAlgorithm |
getLayoutAlgorithm()
Gets the current layout algorithm.
|
boolean |
getLightTouchEnabled()
Gets whether light touches are enabled.
|
boolean |
getLoadsImagesAutomatically()
Gets whether the WebView loads image resources.
|
boolean |
getLoadWithOverviewMode()
Gets whether this WebView loads pages in overview mode.
|
boolean |
getMediaPlaybackRequiresUserGesture()
Gets whether the WebView requires a user gesture to play media.
|
int |
getMinimumFontSize()
Gets the minimum font size.
|
int |
getMinimumLogicalFontSize()
Gets the minimum logical font size.
|
boolean |
getNavDump()
Deprecated.
|
boolean |
getPluginsEnabled()
Deprecated.
|
String |
getPluginsPath()
Deprecated.
|
WebSettings.PluginState |
getPluginState()
Gets the current state regarding whether plugins are enabled.
|
String |
getProperty(String key) |
String |
getSansSerifFontFamily()
Gets the sans-serif font family name.
|
boolean |
getSaveFormData()
Gets whether the WebView saves form data.
|
boolean |
getSavePassword()
Gets whether the WebView saves passwords.
|
String |
getSerifFontFamily()
Gets the serif font family name.
|
boolean |
getShowVisualIndicator() |
String |
getStandardFontFamily()
Gets the standard font family name.
|
int |
getTextZoom()
Gets the text zoom of the page in percent.
|
boolean |
getUseDoubleTree()
Deprecated.
|
int |
getUserAgent()
Deprecated.
|
String |
getUserAgentString()
Gets the WebView's user-agent string.
|
boolean |
getUseWebViewBackgroundForOverscrollBackground()
Deprecated.
|
boolean |
getUseWideViewPort()
Gets whether the WebView is using a wide viewport.
|
void |
setAllowContentAccess(boolean allow)
Enables or disables content URL access within WebView.
|
void |
setAllowFileAccess(boolean allow)
Enables or disables file access within WebView.
|
void |
setAllowFileAccessFromFileURLs(boolean flag)
Sets whether JavaScript running in the context of a file scheme URL
should be allowed to access content from other file scheme URLs.
|
void |
setAllowUniversalAccessFromFileURLs(boolean flag)
Sets whether JavaScript running in the context of a file scheme URL
should be allowed to access content from any origin.
|
void |
setAppCacheEnabled(boolean flag)
Sets whether the Application Caches API should be enabled.
|
void |
setAppCacheMaxSize(long appCacheMaxSize)
Sets the maximum size for the Application Cache content.
|
void |
setAppCachePath(String path)
Sets the path to the Application Caches files.
|
void |
setAutoFillEnabled(boolean enabled) |
void |
setAutoFillProfile(WebSettingsClassic.AutoFillProfile profile) |
void |
setBlockNetworkImage(boolean flag)
Sets whether the WebView should not load image resources from the
network (resources accessed via http and https URI schemes).
|
void |
setBlockNetworkLoads(boolean flag)
Sets whether the WebView should not load resources from the network.
|
void |
setBuiltInZoomControls(boolean enabled)
Sets whether the WebView should use its built-in zoom mechanisms.
|
void |
setCacheMode(int mode)
Overrides the way the cache is used.
|
void |
setCursiveFontFamily(String font)
Sets the cursive font family name.
|
void |
setDatabaseEnabled(boolean flag)
Sets whether the database storage API is enabled.
|
void |
setDatabasePath(String databasePath)
Sets the path to where database storage API databases should be saved.
|
void |
setDefaultFixedFontSize(int size)
Sets the default fixed font size.
|
void |
setDefaultFontSize(int size)
Sets the default font size.
|
void |
setDefaultTextEncodingName(String encoding)
Sets the default text encoding name to use when decoding html pages.
|
void |
setDefaultZoom(WebSettings.ZoomDensity zoom)
Sets the default zoom density of the page.
|
void |
setDisplayZoomControls(boolean enabled)
Sets whether the WebView should display on-screen zoom controls when
using the built-in zoom mechanisms.
|
void |
setDomStorageEnabled(boolean flag)
Sets whether the DOM storage API is enabled.
|
void |
setDoubleTapZoom(int doubleTapZoom)
Set the double-tap zoom of the page in percent.
|
void |
setEnableSmoothTransition(boolean enable)
Sets whether the WebView will enable smooth transition while panning or
zooming or while the window hosting the WebView does not have focus.
|
void |
setFantasyFontFamily(String font)
Sets the fantasy font family name.
|
void |
setFixedFontFamily(String font)
Sets the fixed font family name.
|
void |
setForceUserScalable(boolean flag)
Sets whether viewport metatag can disable zooming.
|
void |
setGeolocationDatabasePath(String databasePath)
Sets the path where the Geolocation databases should be saved.
|
void |
setGeolocationEnabled(boolean flag)
Sets whether Geolocation is enabled.
|
void |
setHardwareAccelSkiaEnabled(boolean flag)
Tell the WebView to use Skia's hardware accelerated rendering path
|
void |
setJavaScriptCanOpenWindowsAutomatically(boolean flag)
Tells JavaScript to open windows automatically.
|
void |
setJavaScriptEnabled(boolean flag)
Tells the WebView to enable JavaScript execution.
|
void |
setLayoutAlgorithm(WebSettings.LayoutAlgorithm l)
Sets the underlying layout algorithm.
|
void |
setLightTouchEnabled(boolean enabled)
Enables using light touches to make a selection and activate mouseovers.
|
void |
setLinkPrefetchEnabled(boolean flag)
Enables/disables HTML5 link "prefetch" parameter.
|
void |
setLoadsImagesAutomatically(boolean flag)
Sets whether the WebView should load image resources.
|
void |
setLoadWithOverviewMode(boolean overview)
Sets whether the WebView loads pages in overview mode.
|
void |
setMaximumDecodedImageSize(long size)
Specify the maximum decoded image size.
|
void |
setMediaPlaybackRequiresUserGesture(boolean support)
Sets whether the WebView requires a user gesture to play media.
|
void |
setMinimumFontSize(int size)
Sets the minimum font size.
|
void |
setMinimumLogicalFontSize(int size)
Sets the minimum logical font size.
|
void |
setNavDump(boolean enabled)
Deprecated.
|
void |
setNeedInitialFocus(boolean flag)
Tells the WebView whether it needs to set a node to have focus when
View.requestFocus(int, android.graphics.Rect) is called. |
void |
setPageCacheCapacity(int size)
Set the number of pages cached by the WebKit for the history navigation.
|
void |
setPluginsEnabled(boolean flag)
Deprecated.
|
void |
setPluginsPath(String pluginsPath)
Deprecated.
|
void |
setPluginState(WebSettings.PluginState state)
Tells the WebView to enable, disable, or have plugins on demand.
|
void |
setProperty(String key,
String value) |
void |
setRenderPriority(WebSettings.RenderPriority priority)
Sets the priority of the Render thread.
|
void |
setSansSerifFontFamily(String font)
Sets the sans-serif font family name.
|
void |
setSaveFormData(boolean save)
Sets whether the WebView should save form data.
|
void |
setSavePassword(boolean save)
Sets whether the WebView should save passwords.
|
void |
setSerifFontFamily(String font)
Sets the serif font family name.
|
void |
setShowVisualIndicator(boolean flag)
Tell the WebView to show the visual indicator
|
void |
setShrinksStandaloneImagesToFit(boolean shrink)
If set, webkit alternately shrinks and expands images viewed outside
of an HTML page to fit the screen.
|
void |
setStandardFontFamily(String font)
Sets the standard font family name.
|
void |
setSupportMultipleWindows(boolean support)
Sets whether the WebView whether supports multiple windows.
|
void |
setSupportZoom(boolean support)
Sets whether the WebView should support zooming using its on-screen zoom
controls and gestures.
|
void |
setTextZoom(int textZoom)
Sets the text zoom of the page in percent.
|
void |
setUseDoubleTree(boolean use)
Deprecated.
|
void |
setUserAgent(int ua)
Deprecated.
|
void |
setUserAgentString(String ua)
Sets the WebView's user-agent string.
|
void |
setUseWebViewBackgroundForOverscrollBackground(boolean view)
Deprecated.
|
void |
setUseWideViewPort(boolean use)
Tells the WebView to use a wide viewport.
|
void |
setWorkersEnabled(boolean flag)
Tell the WebView to enable WebWorkers API.
|
void |
setXSSAuditorEnabled(boolean flag)
Sets whether XSS Auditor is enabled.
|
boolean |
supportMultipleWindows()
Gets whether the WebView supports multiple windows.
|
boolean |
supportZoom()
Gets whether the WebView supports zoom.
|
getDefaultUserAgent, getTextSize, setTextSize
public static String getDefaultUserAgentForLocale(Context context, Locale locale)
WebSettings.setUserAgent(int)
or
WebSettings.setUserAgentString(String)
.context
- a Context object used to access application assetslocale
- The Locale to use in the User-Agent string.WebViewFactoryProvider#getDefaultUserAgent(Context)
,
WebView#getDefaultUserAgent(Context)
@Deprecated public void setNavDump(boolean enabled)
WebSettings
setNavDump
in class WebSettings
WebSettings.setNavDump(boolean)
@Deprecated public boolean getNavDump()
WebSettings
getNavDump
in class WebSettings
WebSettings.getNavDump()
public void setSupportZoom(boolean support)
WebSettings
WebSettings.setBuiltInZoomControls(boolean)
. This setting does not
affect zooming performed using the WebView.zoomIn()
and
WebView.zoomOut()
methods. The default is true.setSupportZoom
in class WebSettings
support
- whether the WebView should support zoomWebSettings.setSupportZoom(boolean)
public boolean supportZoom()
WebSettings
supportZoom
in class WebSettings
WebSettings.supportZoom()
public void setMediaPlaybackRequiresUserGesture(boolean support)
WebSettings
setMediaPlaybackRequiresUserGesture
in class WebSettings
support
- whether the WebView requires a user gesture to play mediaWebSettings.setMediaPlaybackRequiresUserGesture(boolean)
public boolean getMediaPlaybackRequiresUserGesture()
WebSettings
getMediaPlaybackRequiresUserGesture
in class WebSettings
WebSettings.getMediaPlaybackRequiresUserGesture()
public void setBuiltInZoomControls(boolean enabled)
WebSettings
WebSettings.setDisplayZoomControls(boolean)
. The default is false.
The built-in mechanisms are the only currently supported zoom mechanisms, so it is recommended that this setting is always enabled.
setBuiltInZoomControls
in class WebSettings
enabled
- whether the WebView should use its built-in zoom mechanismsWebSettings.setBuiltInZoomControls(boolean)
public boolean getBuiltInZoomControls()
WebSettings
getBuiltInZoomControls
in class WebSettings
WebSettings.getBuiltInZoomControls()
public void setDisplayZoomControls(boolean enabled)
WebSettings
WebSettings.setBuiltInZoomControls(boolean)
.
The default is true.setDisplayZoomControls
in class WebSettings
enabled
- whether the WebView should display on-screen zoom controlsWebSettings.setDisplayZoomControls(boolean)
public boolean getDisplayZoomControls()
WebSettings
getDisplayZoomControls
in class WebSettings
WebSettings.getDisplayZoomControls()
public void setAllowFileAccess(boolean allow)
WebSettings
setAllowFileAccess
in class WebSettings
WebSettings.setAllowFileAccess(boolean)
public boolean getAllowFileAccess()
WebSettings
getAllowFileAccess
in class WebSettings
WebSettings.getAllowFileAccess()
public void setAllowContentAccess(boolean allow)
WebSettings
setAllowContentAccess
in class WebSettings
WebSettings.setAllowContentAccess(boolean)
public boolean getAllowContentAccess()
WebSettings
getAllowContentAccess
in class WebSettings
WebSettings.getAllowContentAccess()
public void setLoadWithOverviewMode(boolean overview)
WebSettings
setLoadWithOverviewMode
in class WebSettings
WebSettings.setLoadWithOverviewMode(boolean)
public boolean getLoadWithOverviewMode()
WebSettings
getLoadWithOverviewMode
in class WebSettings
WebSettings.getLoadWithOverviewMode()
public void setEnableSmoothTransition(boolean enable)
WebSettings
setEnableSmoothTransition
in class WebSettings
WebSettings.setEnableSmoothTransition(boolean)
public boolean enableSmoothTransition()
WebSettings
enableSmoothTransition
in class WebSettings
WebSettings.enableSmoothTransition()
@Deprecated public void setUseWebViewBackgroundForOverscrollBackground(boolean view)
WebSettings
setUseWebViewBackgroundForOverscrollBackground
in class WebSettings
WebSettings.setUseWebViewBackgroundForOverscrollBackground(boolean)
@Deprecated public boolean getUseWebViewBackgroundForOverscrollBackground()
WebSettings
getUseWebViewBackgroundForOverscrollBackground
in class WebSettings
WebSettings.getUseWebViewBackgroundForOverscrollBackground()
public void setSaveFormData(boolean save)
WebSettings
setSaveFormData
in class WebSettings
WebSettings.setSaveFormData(boolean)
public boolean getSaveFormData()
WebSettings
getSaveFormData
in class WebSettings
WebSettings.getSaveFormData()
public void setSavePassword(boolean save)
WebSettings
setSavePassword
in class WebSettings
WebSettings.setSavePassword(boolean)
public boolean getSavePassword()
WebSettings
getSavePassword
in class WebSettings
WebSettings.getSavePassword()
public void setTextZoom(int textZoom)
WebSettings
setTextZoom
in class WebSettings
textZoom
- the text zoom in percentWebSettings.setTextZoom(int)
public int getTextZoom()
WebSettings
getTextZoom
in class WebSettings
WebSettings.getTextZoom()
public void setDoubleTapZoom(int doubleTapZoom)
doubleTapZoom
- A percent value for increasing or decreasing the double-tap zoom.public int getDoubleTapZoom()
public void setDefaultZoom(WebSettings.ZoomDensity zoom)
WebSettings
WebSettings.ZoomDensity.MEDIUM
.setDefaultZoom
in class WebSettings
zoom
- the zoom densityandroid.webkit.WebSettings#setDefaultZoom(android.webkit.WebSettingsClassic.ZoomDensity)
public WebSettings.ZoomDensity getDefaultZoom()
WebSettings
getDefaultZoom
in class WebSettings
WebSettings.getDefaultZoom()
public void setLightTouchEnabled(boolean enabled)
WebSettings
setLightTouchEnabled
in class WebSettings
WebSettings.setLightTouchEnabled(boolean)
public boolean getLightTouchEnabled()
WebSettings
getLightTouchEnabled
in class WebSettings
WebSettings.getLightTouchEnabled()
@Deprecated public void setUseDoubleTree(boolean use)
WebSettings
setUseDoubleTree
in class WebSettings
WebSettings.setUseDoubleTree(boolean)
@Deprecated public boolean getUseDoubleTree()
WebSettings
getUseDoubleTree
in class WebSettings
WebSettings.getUseDoubleTree()
@Deprecated public void setUserAgent(int ua)
WebSettings
setUserAgent
in class WebSettings
ua
- the integer code for the user-agent stringWebSettings.setUserAgent(int)
@Deprecated public int getUserAgent()
WebSettings
WebSettings.setUserAgentString(java.lang.String)
getUserAgent
in class WebSettings
WebSettings.getUserAgent()
public void setUseWideViewPort(boolean use)
WebSettings
setUseWideViewPort
in class WebSettings
use
- whether to use a wide viewportWebSettings.setUseWideViewPort(boolean)
public boolean getUseWideViewPort()
WebSettings
getUseWideViewPort
in class WebSettings
WebSettings.getUseWideViewPort()
public void setSupportMultipleWindows(boolean support)
WebSettings
WebChromeClient.onCreateWindow(android.webkit.WebView, boolean, boolean, android.os.Message)
must be implemented by the
host application. The default is false.setSupportMultipleWindows
in class WebSettings
support
- whether to suport multiple windowsWebSettings.setSupportMultipleWindows(boolean)
public boolean supportMultipleWindows()
WebSettings
supportMultipleWindows
in class WebSettings
WebSettings.supportMultipleWindows()
public void setLayoutAlgorithm(WebSettings.LayoutAlgorithm l)
WebSettings
WebSettings.LayoutAlgorithm.NARROW_COLUMNS
.setLayoutAlgorithm
in class WebSettings
l
- the layout algorithm to use, as a WebSettings.LayoutAlgorithm
valueandroid.webkit.WebSettings#setLayoutAlgorithm(android.webkit.WebSettingsClassic.LayoutAlgorithm)
public WebSettings.LayoutAlgorithm getLayoutAlgorithm()
WebSettings
getLayoutAlgorithm
in class WebSettings
WebSettings.LayoutAlgorithm
valueWebSettings.getLayoutAlgorithm()
public void setStandardFontFamily(String font)
WebSettings
setStandardFontFamily
in class WebSettings
font
- a font family nameWebSettings.setStandardFontFamily(java.lang.String)
public String getStandardFontFamily()
WebSettings
getStandardFontFamily
in class WebSettings
WebSettings.getStandardFontFamily()
public void setFixedFontFamily(String font)
WebSettings
setFixedFontFamily
in class WebSettings
font
- a font family nameWebSettings.setFixedFontFamily(java.lang.String)
public String getFixedFontFamily()
WebSettings
getFixedFontFamily
in class WebSettings
WebSettings.getFixedFontFamily()
public void setSansSerifFontFamily(String font)
WebSettings
setSansSerifFontFamily
in class WebSettings
font
- a font family nameWebSettings.setSansSerifFontFamily(java.lang.String)
public String getSansSerifFontFamily()
WebSettings
getSansSerifFontFamily
in class WebSettings
WebSettings.getSansSerifFontFamily()
public void setSerifFontFamily(String font)
WebSettings
setSerifFontFamily
in class WebSettings
font
- a font family nameWebSettings.setSerifFontFamily(java.lang.String)
public String getSerifFontFamily()
WebSettings
getSerifFontFamily
in class WebSettings
WebSettings.getSerifFontFamily()
public void setCursiveFontFamily(String font)
WebSettings
setCursiveFontFamily
in class WebSettings
font
- a font family nameWebSettings.setCursiveFontFamily(java.lang.String)
public String getCursiveFontFamily()
WebSettings
getCursiveFontFamily
in class WebSettings
WebSettings.getCursiveFontFamily()
public void setFantasyFontFamily(String font)
WebSettings
setFantasyFontFamily
in class WebSettings
font
- a font family nameWebSettings.setFantasyFontFamily(java.lang.String)
public String getFantasyFontFamily()
WebSettings
getFantasyFontFamily
in class WebSettings
WebSettings.getFantasyFontFamily()
public void setMinimumFontSize(int size)
WebSettings
setMinimumFontSize
in class WebSettings
size
- a non-negative integer between 1 and 72. Any number outside
the specified range will be pinned.WebSettings.setMinimumFontSize(int)
public int getMinimumFontSize()
WebSettings
getMinimumFontSize
in class WebSettings
WebSettings.getMinimumFontSize()
public void setMinimumLogicalFontSize(int size)
WebSettings
setMinimumLogicalFontSize
in class WebSettings
size
- a non-negative integer between 1 and 72. Any number outside
the specified range will be pinned.WebSettings.setMinimumLogicalFontSize(int)
public int getMinimumLogicalFontSize()
WebSettings
getMinimumLogicalFontSize
in class WebSettings
WebSettings.getMinimumLogicalFontSize()
public void setDefaultFontSize(int size)
WebSettings
setDefaultFontSize
in class WebSettings
size
- a non-negative integer between 1 and 72. Any number outside
the specified range will be pinned.WebSettings.setDefaultFontSize(int)
public int getDefaultFontSize()
WebSettings
getDefaultFontSize
in class WebSettings
WebSettings.getDefaultFontSize()
public void setDefaultFixedFontSize(int size)
WebSettings
setDefaultFixedFontSize
in class WebSettings
size
- a non-negative integer between 1 and 72. Any number outside
the specified range will be pinned.WebSettings.setDefaultFixedFontSize(int)
public int getDefaultFixedFontSize()
WebSettings
getDefaultFixedFontSize
in class WebSettings
WebSettings.getDefaultFixedFontSize()
public void setPageCacheCapacity(int size)
size
- A non-negative integer between 0 (no cache) and 20 (max).public void setLoadsImagesAutomatically(boolean flag)
WebSettings
WebSettings.setBlockNetworkImage(boolean)
to control loading only
of images specified using network URI schemes. Note that if the value of this
setting is changed from false to true, all images resources referenced
by content currently displayed by the WebView are loaded automatically.
The default is true.setLoadsImagesAutomatically
in class WebSettings
flag
- whether the WebView should load image resourcesWebSettings.setLoadsImagesAutomatically(boolean)
public boolean getLoadsImagesAutomatically()
WebSettings
getLoadsImagesAutomatically
in class WebSettings
WebSettings.getLoadsImagesAutomatically()
public void setBlockNetworkImage(boolean flag)
WebSettings
WebSettings.getLoadsImagesAutomatically()
returns true. Also note that
disabling all network loads using WebSettings.setBlockNetworkLoads(boolean)
will also prevent network images from loading, even if this flag is set
to false. When the value of this setting is changed from true to false,
network images resources referenced by content currently displayed by
the WebView are fetched automatically. The default is false.setBlockNetworkImage
in class WebSettings
flag
- whether the WebView should not load image resources from the
networkWebSettings.setBlockNetworkImage(boolean)
public boolean getBlockNetworkImage()
WebSettings
getBlockNetworkImage
in class WebSettings
WebSettings.getBlockNetworkImage()
public void setBlockNetworkLoads(boolean flag)
WebSettings
WebSettings.setBlockNetworkImage(boolean)
to only avoid loading
image resources. Note that if the value of this setting is
changed from true to false, network resources referenced by content
currently displayed by the WebView are not fetched until
WebView.reload()
is called.
If the application does not have the
android.Manifest.permission#INTERNET
permission, attempts to set
a value of false will cause a SecurityException
to be thrown. The default value is false if the application has the
android.Manifest.permission#INTERNET
permission, otherwise it is
true.setBlockNetworkLoads
in class WebSettings
flag
- whether the WebView should not load any resources from the
networkWebSettings.setBlockNetworkLoads(boolean)
public boolean getBlockNetworkLoads()
WebSettings
getBlockNetworkLoads
in class WebSettings
WebSettings.getBlockNetworkLoads()
public void setJavaScriptEnabled(boolean flag)
WebSettings
setJavaScriptEnabled
in class WebSettings
flag
- true if the WebView should execute JavaScriptWebSettings.setJavaScriptEnabled(boolean)
public void setAllowUniversalAccessFromFileURLs(boolean flag)
WebSettings
WebSettings.setAllowFileAccessFromFileURLs(boolean)
. To enable the most restrictive,
and therefore secure policy, this setting should be disabled.
The default value is true for API level
Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
and below,
and false for API level Build.VERSION_CODES.JELLY_BEAN
and above.
setAllowUniversalAccessFromFileURLs
in class WebSettings
flag
- whether JavaScript running in the context of a file scheme
URL should be allowed to access content from any originWebSettings.setAllowUniversalAccessFromFileURLs(boolean)
public void setAllowFileAccessFromFileURLs(boolean flag)
WebSettings
WebSettings.getAllowUniversalAccessFromFileURLs()
is true.
The default value is true for API level
Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
and below,
and false for API level Build.VERSION_CODES.JELLY_BEAN
and above.
setAllowFileAccessFromFileURLs
in class WebSettings
flag
- whether JavaScript running in the context of a file scheme
URL should be allowed to access content from other file
scheme URLsWebSettings.setAllowFileAccessFromFileURLs(boolean)
public void setHardwareAccelSkiaEnabled(boolean flag)
flag
- True if the WebView should use Skia's hw-accel pathpublic boolean getHardwareAccelSkiaEnabled()
public void setShowVisualIndicator(boolean flag)
flag
- True if the WebView should show the visual indicatorpublic boolean getShowVisualIndicator()
@Deprecated public void setPluginsEnabled(boolean flag)
WebSettings
setPluginsEnabled
in class WebSettings
flag
- true if plugins should be enabledWebSettings.setPluginsEnabled(boolean)
public void setPluginState(WebSettings.PluginState state)
WebSettings
WebSettings.PluginState.OFF
.setPluginState
in class WebSettings
state
- a PluginState valueandroid.webkit.WebSettings#setPluginState(android.webkit.WebSettingsClassic.PluginState)
@Deprecated public void setPluginsPath(String pluginsPath)
WebSettings
setPluginsPath
in class WebSettings
pluginsPath
- a String path to the directory containing pluginsWebSettings.setPluginsPath(java.lang.String)
public void setDatabasePath(String databasePath)
WebSettings
setDatabasePath
in class WebSettings
databasePath
- a path to the directory where databases should be
saved.WebSettings.setDatabasePath(java.lang.String)
public void setGeolocationDatabasePath(String databasePath)
WebSettings
setGeolocationDatabasePath
in class WebSettings
databasePath
- a path to the directory where databases should be
saved.WebSettings.setGeolocationDatabasePath(java.lang.String)
public void setAppCacheEnabled(boolean flag)
WebSettings
WebSettings.setAppCachePath(java.lang.String)
.setAppCacheEnabled
in class WebSettings
flag
- true if the WebView should enable Application CachesWebSettings.setAppCacheEnabled(boolean)
public void setAppCachePath(String path)
WebSettings
setAppCachePath
in class WebSettings
path
- a String path to the directory containing
Application Caches files.WebSettings.setAppCachePath(java.lang.String)
public void setAppCacheMaxSize(long appCacheMaxSize)
WebSettings
Long.MAX_VALUE
.setAppCacheMaxSize
in class WebSettings
appCacheMaxSize
- the maximum size in bytesWebSettings.setAppCacheMaxSize(long)
public void setDatabaseEnabled(boolean flag)
WebSettings
WebSettings.setDatabasePath(java.lang.String)
for how to correctly set up the
database storage API.setDatabaseEnabled
in class WebSettings
flag
- true if the WebView should use the database storage APIWebSettings.setDatabaseEnabled(boolean)
public void setDomStorageEnabled(boolean flag)
WebSettings
setDomStorageEnabled
in class WebSettings
flag
- true if the WebView should use the DOM storage APIWebSettings.setDomStorageEnabled(boolean)
public boolean getDomStorageEnabled()
WebSettings
getDomStorageEnabled
in class WebSettings
WebSettings.getDomStorageEnabled()
public String getDatabasePath()
WebSettings
getDatabasePath
in class WebSettings
WebSettings.getDatabasePath()
public boolean getDatabaseEnabled()
WebSettings
getDatabaseEnabled
in class WebSettings
WebSettings.getDatabaseEnabled()
public void setWorkersEnabled(boolean flag)
flag
- True if the WebView should enable WebWorkers.
Note that this flag only affects V8. JSC does not have
an equivalent setting.public void setGeolocationEnabled(boolean flag)
WebSettings
WebSettings.setGeolocationDatabasePath(java.lang.String)
for how to correctly set up
Geolocation.setGeolocationEnabled
in class WebSettings
flag
- whether Geolocation should be enabledWebSettings.setGeolocationEnabled(boolean)
public void setXSSAuditorEnabled(boolean flag)
flag
- Whether XSS Auditor should be enabled.public void setLinkPrefetchEnabled(boolean flag)
public boolean getJavaScriptEnabled()
WebSettings
getJavaScriptEnabled
in class WebSettings
WebSettings.getJavaScriptEnabled()
public boolean getAllowUniversalAccessFromFileURLs()
WebSettings
getAllowUniversalAccessFromFileURLs
in class WebSettings
android.webkit.WebSettings#getAllowUniversalFileAccessFromFileURLs
public boolean getAllowFileAccessFromFileURLs()
WebSettings
getAllowFileAccessFromFileURLs
in class WebSettings
WebSettings.getAllowFileAccessFromFileURLs()
@Deprecated public boolean getPluginsEnabled()
WebSettings
getPluginsEnabled
in class WebSettings
WebSettings.getPluginsEnabled()
public WebSettings.PluginState getPluginState()
WebSettings
getPluginState
in class WebSettings
WebSettings.PluginState
valueWebSettings.getPluginState()
@Deprecated public String getPluginsPath()
WebSettings
getPluginsPath
in class WebSettings
WebSettings.getPluginsPath()
public void setJavaScriptCanOpenWindowsAutomatically(boolean flag)
WebSettings
setJavaScriptCanOpenWindowsAutomatically
in class WebSettings
flag
- true if JavaScript can open windows automaticallyWebSettings.setJavaScriptCanOpenWindowsAutomatically(boolean)
public boolean getJavaScriptCanOpenWindowsAutomatically()
WebSettings
getJavaScriptCanOpenWindowsAutomatically
in class WebSettings
WebSettings.getJavaScriptCanOpenWindowsAutomatically()
public void setDefaultTextEncodingName(String encoding)
WebSettings
setDefaultTextEncodingName
in class WebSettings
encoding
- the text encoding nameWebSettings.setDefaultTextEncodingName(java.lang.String)
public String getDefaultTextEncodingName()
WebSettings
getDefaultTextEncodingName
in class WebSettings
WebSettings.getDefaultTextEncodingName()
public void setUserAgentString(String ua)
WebSettings
setUserAgentString
in class WebSettings
WebSettings.setUserAgentString(java.lang.String)
public String getUserAgentString()
WebSettings
getUserAgentString
in class WebSettings
WebSettings.getUserAgentString()
public void setNeedInitialFocus(boolean flag)
WebSettings
View.requestFocus(int, android.graphics.Rect)
is called. The
default value is true.setNeedInitialFocus
in class WebSettings
flag
- whether the WebView needs to set a nodeWebSettings.setNeedInitialFocus(boolean)
public void setRenderPriority(WebSettings.RenderPriority priority)
WebSettings
WebSettings.RenderPriority.NORMAL
.setRenderPriority
in class WebSettings
priority
- the priorityandroid.webkit.WebSettings#setRenderPriority(android.webkit.WebSettingsClassic.RenderPriority)
public void setCacheMode(int mode)
WebSettings
WebSettings.LOAD_DEFAULT
, WebSettings.LOAD_NORMAL
,
WebSettings.LOAD_CACHE_ELSE_NETWORK
, WebSettings.LOAD_NO_CACHE
or
WebSettings.LOAD_CACHE_ONLY
. The default value is WebSettings.LOAD_DEFAULT
.setCacheMode
in class WebSettings
mode
- the mode to useWebSettings.setCacheMode(int)
public int getCacheMode()
WebSettings
getCacheMode
in class WebSettings
WebSettings.getCacheMode()
public void setShrinksStandaloneImagesToFit(boolean shrink)
shrink
- Set true to let webkit shrink the standalone image to fit.public void setMaximumDecodedImageSize(long size)
size
- The maximum decoded size, or zero to set to the default.public boolean forceUserScalable()
public void setForceUserScalable(boolean flag)
flag
- Whether or not to forceably enable user scalable.public void setAutoFillEnabled(boolean enabled)
public boolean getAutoFillEnabled()
public void setAutoFillProfile(WebSettingsClassic.AutoFillProfile profile)
public WebSettingsClassic.AutoFillProfile getAutoFillProfile()