Sdílet prostřednictvím


WebSettings.ForceDark Property

Definition

Get the force dark mode for this WebView. -or- Set the force dark mode for this WebView.

public virtual Android.Webkit.ForceDarkMode ForceDark { [Android.Runtime.Register("getForceDark", "()I", "GetGetForceDarkHandler", ApiSince=29)] get; [Android.Runtime.Register("setForceDark", "(I)V", "GetSetForceDark_IHandler", ApiSince=29)] set; }
[<get: Android.Runtime.Register("getForceDark", "()I", "GetGetForceDarkHandler", ApiSince=29)>]
[<set: Android.Runtime.Register("setForceDark", "(I)V", "GetSetForceDark_IHandler", ApiSince=29)>]
member this.ForceDark : Android.Webkit.ForceDarkMode with get, set

Property Value

the currently set force dark mode.

Attributes

Remarks

Property getter documentation:

Get the force dark mode for this WebView. The default force dark mode is #FORCE_DARK_AUTO.

This member is deprecated. refer to #setForceDark.

Java documentation for android.webkit.WebSettings.getForceDark().

Property setter documentation:

Set the force dark mode for this WebView.

This member is deprecated. The "force dark" model previously implemented by WebView was complex and didn't interoperate well with current Web standards for prefers-color-scheme and color-scheme. In apps with targetSdkVersion &ge; android.os.Build.VERSION_CODES#TIRAMISU this API is a no-op and WebView will always use the dark style defined by web content authors if the app's theme is dark. To customize the behavior, refer to #setAlgorithmicDarkeningAllowed.

Java documentation for android.webkit.WebSettings.setForceDark(int).

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