IT. Expert System.

Android Reference

WebSettings


android.webkit

Class WebSettings

  • Direct Known Subclasses:
    WebSettingsClassic


    public abstract class WebSettings
    extends Object
    Manages settings state for a WebView. When a WebView is first created, it obtains a set of default settings. These default settings will be returned from any getter call. A WebSettings object obtained from WebView.getSettings() is tied to the life of the WebView. If a WebView has been destroyed, any method call on WebSettings will throw an IllegalStateException.
    • Constructor Detail

      • WebSettings

        protected WebSettings()
        Hidden constructor to prevent clients from creating a new settings instance or deriving the class.
    • Method Detail

      • setNavDump

        @Deprecated
        public void setNavDump(boolean enabled)
        Deprecated. This method is now obsolete.
        Enables dumping the pages navigation cache to a text file. The default is false.
      • getNavDump

        @Deprecated
        public boolean getNavDump()
        Deprecated. This method is now obsolete.
        Gets whether dumping the navigation cache is enabled.
        Returns:
        whether dumping the navigation cache is enabled
        See Also:
        setNavDump(boolean)
      • setSupportZoom

        public void setSupportZoom(boolean support)
        Sets whether the WebView should support zooming using its on-screen zoom controls and gestures. The particular zoom mechanisms that should be used can be set with setBuiltInZoomControls(boolean). This setting does not affect zooming performed using the WebView.zoomIn() and WebView.zoomOut() methods. The default is true.
        Parameters:
        support - whether the WebView should support zoom
      • supportZoom

        public boolean supportZoom()
        Gets whether the WebView supports zoom.
        Returns:
        true if the WebView supports zoom
        See Also:
        setSupportZoom(boolean)
      • setMediaPlaybackRequiresUserGesture

        public void setMediaPlaybackRequiresUserGesture(boolean require)
        Sets whether the WebView requires a user gesture to play media. The default is true.
        Parameters:
        require - whether the WebView requires a user gesture to play media
      • getMediaPlaybackRequiresUserGesture

        public boolean getMediaPlaybackRequiresUserGesture()
        Gets whether the WebView requires a user gesture to play media.
        Returns:
        true if the WebView requires a user gesture to play media
        See Also:
        setMediaPlaybackRequiresUserGesture(boolean)
      • setBuiltInZoomControls

        public void setBuiltInZoomControls(boolean enabled)
        Sets whether the WebView should use its built-in zoom mechanisms. The built-in zoom mechanisms comprise on-screen zoom controls, which are displayed over the WebView's content, and the use of a pinch gesture to control zooming. Whether or not these on-screen controls are displayed can be set with 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.

        Parameters:
        enabled - whether the WebView should use its built-in zoom mechanisms
      • getBuiltInZoomControls

        public boolean getBuiltInZoomControls()
        Gets whether the zoom mechanisms built into WebView are being used.
        Returns:
        true if the zoom mechanisms built into WebView are being used
        See Also:
        setBuiltInZoomControls(boolean)
      • setDisplayZoomControls

        public void setDisplayZoomControls(boolean enabled)
        Sets whether the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. See setBuiltInZoomControls(boolean). The default is true.
        Parameters:
        enabled - whether the WebView should display on-screen zoom controls
      • getDisplayZoomControls

        public boolean getDisplayZoomControls()
        Gets whether the WebView displays on-screen zoom controls when using the built-in zoom mechanisms.
        Returns:
        true if the WebView displays on-screen zoom controls when using the built-in zoom mechanisms
        See Also:
        setDisplayZoomControls(boolean)
      • setAllowFileAccess

        public void setAllowFileAccess(boolean allow)
        Enables or disables file access within WebView. File access is enabled by default. Note that this enables or disables file system access only. Assets and resources are still accessible using file:///android_asset and file:///android_res.
      • getAllowFileAccess

        public boolean getAllowFileAccess()
        Gets whether this WebView supports file access.
        See Also:
        setAllowFileAccess(boolean)
      • setAllowContentAccess

        public void setAllowContentAccess(boolean allow)
        Enables or disables content URL access within WebView. Content URL access allows WebView to load content from a content provider installed in the system. The default is enabled.
      • getAllowContentAccess

        public boolean getAllowContentAccess()
        Gets whether this WebView supports content URL access.
        See Also:
        setAllowContentAccess(boolean)
      • setLoadWithOverviewMode

        public void setLoadWithOverviewMode(boolean overview)
        Sets whether the WebView loads pages in overview mode. The default is false.
      • getLoadWithOverviewMode

        public boolean getLoadWithOverviewMode()
        Gets whether this WebView loads pages in overview mode.
        Returns:
        whether this WebView loads pages in overview mode
        See Also:
        setLoadWithOverviewMode(boolean)
      • setEnableSmoothTransition

        @Deprecated
        public void setEnableSmoothTransition(boolean enable)
        Deprecated. This method is now obsolete, and will become a no-op in future.
        Sets whether the WebView will enable smooth transition while panning or zooming or while the window hosting the WebView does not have focus. If it is true, WebView will choose a solution to maximize the performance. e.g. the WebView's content may not be updated during the transition. If it is false, WebView will keep its fidelity. The default value is false.
      • enableSmoothTransition

        @Deprecated
        public boolean enableSmoothTransition()
        Deprecated. This method is now obsolete, and will become a no-op in future.
        Gets whether the WebView enables smooth transition while panning or zooming.
        See Also:
        setEnableSmoothTransition(boolean)
      • setUseWebViewBackgroundForOverscrollBackground

        @Deprecated
        public void setUseWebViewBackgroundForOverscrollBackground(boolean view)
        Deprecated. This method is now obsolete.
        Sets whether the WebView uses its background for over scroll background. If true, it will use the WebView's background. If false, it will use an internal pattern. Default is true.
      • getUseWebViewBackgroundForOverscrollBackground

        @Deprecated
        public boolean getUseWebViewBackgroundForOverscrollBackground()
        Deprecated. This method is now obsolete.
        Gets whether this WebView uses WebView's background instead of internal pattern for over scroll background.
        See Also:
        setUseWebViewBackgroundForOverscrollBackground(boolean)
      • setSaveFormData

        public void setSaveFormData(boolean save)
        Sets whether the WebView should save form data. The default is true, unless in private browsing mode, when the value is always false.
      • getSaveFormData

        public boolean getSaveFormData()
        Gets whether the WebView saves form data. Always false in private browsing mode.
        Returns:
        whether the WebView saves form data
        See Also:
        setSaveFormData(boolean)
      • setSavePassword

        public void setSavePassword(boolean save)
        Sets whether the WebView should save passwords. The default is true.
      • getSavePassword

        public boolean getSavePassword()
        Gets whether the WebView saves passwords.
        Returns:
        whether the WebView saves passwords
        See Also:
        setSavePassword(boolean)
      • setTextZoom

        public void setTextZoom(int textZoom)
        Sets the text zoom of the page in percent. The default is 100.
        Parameters:
        textZoom - the text zoom in percent
      • getTextZoom

        public int getTextZoom()
        Gets the text zoom of the page in percent.
        Returns:
        the text zoom of the page in percent
        See Also:
        setTextZoom(int)
      • setLightTouchEnabled

        public void setLightTouchEnabled(boolean enabled)
        Enables using light touches to make a selection and activate mouseovers. The default is false.
      • getLightTouchEnabled

        public boolean getLightTouchEnabled()
        Gets whether light touches are enabled.
        Returns:
        whether light touches are enabled
        See Also:
        setLightTouchEnabled(boolean)
      • setUseDoubleTree

        @Deprecated
        public void setUseDoubleTree(boolean use)
        Deprecated. This setting now has no effect.
        Controlled a rendering optimization that is no longer present. Setting it now has no effect.
      • getUseDoubleTree

        @Deprecated
        public boolean getUseDoubleTree()
        Deprecated. This setting now has no effect.
        Controlled a rendering optimization that is no longer present. Setting it now has no effect.
      • setUserAgent

        @Deprecated
        public void setUserAgent(int ua)
        Deprecated. Please use setUserAgentString(java.lang.String) instead.
        Sets the user-agent string using an integer code.
        • 0 means the WebView should use an Android user-agent string
        • 1 means the WebView should use a desktop user-agent string
        Other values are ignored. The default is an Android user-agent string, i.e. code value 0.
        Parameters:
        ua - the integer code for the user-agent string
      • getUserAgent

        @Deprecated
        public int getUserAgent()
        Deprecated. Please use getUserAgentString() instead.
        Gets the user-agent as an integer code.
        • -1 means the WebView is using a custom user-agent string set with setUserAgentString(java.lang.String)
        • 0 means the WebView should use an Android user-agent string
        • 1 means the WebView should use a desktop user-agent string
        Returns:
        the integer code for the user-agent string
        See Also:
        setUserAgent(int)
      • setUseWideViewPort

        public void setUseWideViewPort(boolean use)
        Tells the WebView to use a wide viewport. The default is false.
        Parameters:
        use - whether to use a wide viewport
      • getUseWideViewPort

        public boolean getUseWideViewPort()
        Gets whether the WebView is using a wide viewport.
        Returns:
        true if the WebView is using a wide viewport
        See Also:
        setUseWideViewPort(boolean)
      • supportMultipleWindows

        public boolean supportMultipleWindows()
        Gets whether the WebView supports multiple windows.
        Returns:
        true if the WebView supports multiple windows
        See Also:
        setSupportMultipleWindows(boolean)
      • setStandardFontFamily

        public void setStandardFontFamily(String font)
        Sets the standard font family name. The default is "sans-serif".
        Parameters:
        font - a font family name
      • setFixedFontFamily

        public void setFixedFontFamily(String font)
        Sets the fixed font family name. The default is "monospace".
        Parameters:
        font - a font family name
      • setSansSerifFontFamily

        public void setSansSerifFontFamily(String font)
        Sets the sans-serif font family name. The default is "sans-serif".
        Parameters:
        font - a font family name
      • setSerifFontFamily

        public void setSerifFontFamily(String font)
        Sets the serif font family name. The default is "sans-serif".
        Parameters:
        font - a font family name
      • setCursiveFontFamily

        public void setCursiveFontFamily(String font)
        Sets the cursive font family name. The default is "cursive".
        Parameters:
        font - a font family name
      • setFantasyFontFamily

        public void setFantasyFontFamily(String font)
        Sets the fantasy font family name. The default is "fantasy".
        Parameters:
        font - a font family name
      • setMinimumFontSize

        public void setMinimumFontSize(int size)
        Sets the minimum font size. The default is 8.
        Parameters:
        size - a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
      • getMinimumFontSize

        public int getMinimumFontSize()
        Gets the minimum font size.
        Returns:
        a non-negative integer between 1 and 72
        See Also:
        setMinimumFontSize(int)
      • setMinimumLogicalFontSize

        public void setMinimumLogicalFontSize(int size)
        Sets the minimum logical font size. The default is 8.
        Parameters:
        size - a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
      • getMinimumLogicalFontSize

        public int getMinimumLogicalFontSize()
        Gets the minimum logical font size.
        Returns:
        a non-negative integer between 1 and 72
        See Also:
        setMinimumLogicalFontSize(int)
      • setDefaultFontSize

        public void setDefaultFontSize(int size)
        Sets the default font size. The default is 16.
        Parameters:
        size - a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
      • getDefaultFontSize

        public int getDefaultFontSize()
        Gets the default font size.
        Returns:
        a non-negative integer between 1 and 72
        See Also:
        setDefaultFontSize(int)
      • setDefaultFixedFontSize

        public void setDefaultFixedFontSize(int size)
        Sets the default fixed font size. The default is 16.
        Parameters:
        size - a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.
      • getDefaultFixedFontSize

        public int getDefaultFixedFontSize()
        Gets the default fixed font size.
        Returns:
        a non-negative integer between 1 and 72
        See Also:
        setDefaultFixedFontSize(int)
      • setLoadsImagesAutomatically

        public void setLoadsImagesAutomatically(boolean flag)
        Sets whether the WebView should load image resources. Note that this method controls loading of all images, including those embedded using the data URI scheme. Use 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.
        Parameters:
        flag - whether the WebView should load image resources
      • getLoadsImagesAutomatically

        public boolean getLoadsImagesAutomatically()
        Gets whether the WebView loads image resources. This includes images embedded using the data URI scheme.
        Returns:
        true if the WebView loads image resources
        See Also:
        setLoadsImagesAutomatically(boolean)
      • setBlockNetworkImage

        public void setBlockNetworkImage(boolean flag)
        Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes). Note that this method has no effect unless getLoadsImagesAutomatically() returns true. Also note that disabling all network loads using 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.
        Parameters:
        flag - whether the WebView should not load image resources from the network
        See Also:
        setBlockNetworkLoads(boolean)
      • getBlockNetworkImage

        public boolean getBlockNetworkImage()
        Gets whether the WebView does not load image resources from the network.
        Returns:
        true if the WebView does not load image resources from the network
        See Also:
        setBlockNetworkImage(boolean)
      • setBlockNetworkLoads

        public void setBlockNetworkLoads(boolean flag)
        Sets whether the WebView should not load resources from the network. Use 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.
        Parameters:
        flag - whether the WebView should not load any resources from the network
        See Also:
        WebView.reload()
      • getBlockNetworkLoads

        public boolean getBlockNetworkLoads()
        Gets whether the WebView does not load any resources from the network.
        Returns:
        true if the WebView does not load any resources from the network
        See Also:
        setBlockNetworkLoads(boolean)
      • setJavaScriptEnabled

        public void setJavaScriptEnabled(boolean flag)
        Tells the WebView to enable JavaScript execution. The default is false.
        Parameters:
        flag - true if the WebView should execute JavaScript
      • setAllowUniversalAccessFromFileURLs

        public abstract 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. This includes access to content from other file scheme URLs. See 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.

        Parameters:
        flag - whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin
      • setAllowFileAccessFromFileURLs

        public abstract 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. To enable the most restrictive, and therefore secure policy, this setting should be disabled. Note that the value of this setting is ignored if the value of 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.

        Parameters:
        flag - whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs
      • setPluginState

        public void setPluginState(WebSettings.PluginState state)
        Tells the WebView to enable, disable, or have plugins on demand. On demand mode means that if a plugin exists that can handle the embedded content, a placeholder icon will be shown instead of the plugin. When the placeholder is clicked, the plugin will be enabled. The default is WebSettings.PluginState.OFF.
        Parameters:
        state - a PluginState value
      • setPluginsPath

        @Deprecated
        public void setPluginsPath(String pluginsPath)
        Deprecated. This method is no longer used as plugins are loaded from their own APK via the system's package manager.
        Sets a custom path to plugins used by the WebView. This method is obsolete since each plugin is now loaded from its own package.
        Parameters:
        pluginsPath - a String path to the directory containing plugins
      • setDatabasePath

        public void setDatabasePath(String databasePath)
        Sets the path to where database storage API databases should be saved. In order for the database storage API to function correctly, this method must be called with a path to which the application can write. This method should only be called once: repeated calls are ignored.
        Parameters:
        databasePath - a path to the directory where databases should be saved.
      • setGeolocationDatabasePath

        public void setGeolocationDatabasePath(String databasePath)
        Sets the path where the Geolocation databases should be saved. In order for Geolocation permissions and cached positions to be persisted, this method must be called with a path to which the application can write.
        Parameters:
        databasePath - a path to the directory where databases should be saved.
      • setAppCacheEnabled

        public void setAppCacheEnabled(boolean flag)
        Sets whether the Application Caches API should be enabled. The default is false. Note that in order for the Application Caches API to be enabled, a valid database path must also be supplied to setAppCachePath(java.lang.String).
        Parameters:
        flag - true if the WebView should enable Application Caches
      • setAppCachePath

        public void setAppCachePath(String appCachePath)
        Sets the path to the Application Caches files. In order for the Application Caches API to be enabled, this method must be called with a path to which the application can write. This method should only be called once: repeated calls are ignored.
        Parameters:
        appCachePath - a String path to the directory containing Application Caches files.
        See Also:
        setAppCacheEnabled
      • setAppCacheMaxSize

        public void setAppCacheMaxSize(long appCacheMaxSize)
        Sets the maximum size for the Application Cache content. The passed size will be rounded to the nearest value that the database can support, so this should be viewed as a guide, not a hard limit. Setting the size to a value less than current database size does not cause the database to be trimmed. The default size is Long.MAX_VALUE.
        Parameters:
        appCacheMaxSize - the maximum size in bytes
      • setDatabaseEnabled

        public void setDatabaseEnabled(boolean flag)
        Sets whether the database storage API is enabled. The default value is false. See also setDatabasePath(java.lang.String) for how to correctly set up the database storage API.
        Parameters:
        flag - true if the WebView should use the database storage API
      • setDomStorageEnabled

        public void setDomStorageEnabled(boolean flag)
        Sets whether the DOM storage API is enabled. The default value is false.
        Parameters:
        flag - true if the WebView should use the DOM storage API
      • getDomStorageEnabled

        public boolean getDomStorageEnabled()
        Gets whether the DOM Storage APIs are enabled.
        Returns:
        true if the DOM Storage APIs are enabled
        See Also:
        setDomStorageEnabled(boolean)
      • getDatabasePath

        public String getDatabasePath()
        Gets the path to where database storage API databases are saved.
        Returns:
        the String path to the database storage API databases
        See Also:
        setDatabasePath(java.lang.String)
      • getDatabaseEnabled

        public boolean getDatabaseEnabled()
        Gets whether the database storage API is enabled.
        Returns:
        true if the database storage API is enabled
        See Also:
        setDatabaseEnabled(boolean)
      • setGeolocationEnabled

        public void setGeolocationEnabled(boolean flag)
        Sets whether Geolocation is enabled. The default is true. See also setGeolocationDatabasePath(java.lang.String) for how to correctly set up Geolocation.
        Parameters:
        flag - whether Geolocation should be enabled
      • getJavaScriptEnabled

        public boolean getJavaScriptEnabled()
        Gets whether JavaScript is enabled.
        Returns:
        true if JavaScript is enabled
        See Also:
        setJavaScriptEnabled(boolean)
      • getAllowUniversalAccessFromFileURLs

        public abstract boolean getAllowUniversalAccessFromFileURLs()
        Gets whether JavaScript running in the context of a file scheme URL can access content from any origin. This includes access to content from other file scheme URLs.
        Returns:
        whether JavaScript running in the context of a file scheme URL can access content from any origin
        See Also:
        setAllowUniversalAccessFromFileURLs(boolean)
      • getAllowFileAccessFromFileURLs

        public abstract boolean getAllowFileAccessFromFileURLs()
        Gets whether JavaScript running in the context of a file scheme URL can access content from other file scheme URLs.
        Returns:
        whether JavaScript running in the context of a file scheme URL can access content from other file scheme URLs
        See Also:
        setAllowFileAccessFromFileURLs(boolean)
      • getPluginsPath

        @Deprecated
        public String getPluginsPath()
        Deprecated. This method is no longer used as plugins are loaded from their own APK via the system's package manager.
        Gets the directory that contains the plugin libraries. This method is obsolete since each plugin is now loaded from its own package.
        Returns:
        an empty string
      • setJavaScriptCanOpenWindowsAutomatically

        public void setJavaScriptCanOpenWindowsAutomatically(boolean flag)
        Tells JavaScript to open windows automatically. This applies to the JavaScript function window.open(). The default is false.
        Parameters:
        flag - true if JavaScript can open windows automatically
      • getJavaScriptCanOpenWindowsAutomatically

        public boolean getJavaScriptCanOpenWindowsAutomatically()
        Gets whether JavaScript can open windows automatically.
        Returns:
        true if JavaScript can open windows automatically during window.open()
        See Also:
        setJavaScriptCanOpenWindowsAutomatically(boolean)
      • setDefaultTextEncodingName

        public void setDefaultTextEncodingName(String encoding)
        Sets the default text encoding name to use when decoding html pages. The default is "Latin-1".
        Parameters:
        encoding - the text encoding name
      • setUserAgentString

        public void setUserAgentString(String ua)
        Sets the WebView's user-agent string. If the string is null or empty, the system default value will be used.
      • getDefaultUserAgent

        public static String getDefaultUserAgent(Context context)
        Returns the default User-Agent used by a WebView. An instance of WebView could use a different User-Agent if a call is made to setUserAgentString(String).
        Parameters:
        context - a Context object used to access application assets
      • setNeedInitialFocus

        public 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. The default value is true.
        Parameters:
        flag - whether the WebView needs to set a node
      • setRenderPriority

        public void setRenderPriority(WebSettings.RenderPriority priority)
        Sets the priority of the Render thread. Unlike the other settings, this one only needs to be called once per process. The default value is WebSettings.RenderPriority.NORMAL.
        Parameters:
        priority - the priority
      • setCacheMode

        public void setCacheMode(int mode)
        Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed. When navigating back, content is not revalidated, instead the content is just retrieved from the cache. This method allows the client to override this behavior by specifying one of LOAD_DEFAULT, LOAD_NORMAL, LOAD_CACHE_ELSE_NETWORK, LOAD_NO_CACHE or LOAD_CACHE_ONLY. The default value is LOAD_DEFAULT.
        Parameters:
        mode - the mode to use
      • getCacheMode

        public int getCacheMode()
        Gets the current setting for overriding the cache mode.
        Returns:
        the current setting for overriding the cache mode
        See Also:
        setCacheMode(int)


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 876 / . Delta: 0.04620 с