If this is the case then we can go ahead and configure the mode that we wish to use when it comes to the theming of the webview. Under the hood this isFeatureSupported function will check that FORCE_DARK is supported by both the framework and the webview being used. So before we go ahead and set the support for dark mode we’re going to want to check if it is supported: if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) For this, the WebViewFeature class also contains an isFeatureSupported() function, which can be used to check if a given feature is supported. However, before we try and access this feature in any way we need to be sure that it is supported in the current situation that the webview is being used in. Within this webkit is a class called WebViewFeature – this is a collection of available features that can be accessed, and within this collection of features is FORCE_DARK. Within this version of webkit there are a few additions that make the interactions with dark mode settings a small amount of effort. The current stable release of androidx.webkit is version 1.1.0 however, dark mode support has been added in the latest alpha release, 1.2.0-alpha01. To get started with androidx.webkit we need to begin by adding the dependency to our application: implementation "androidx.webkit:webkit:1.2.0-alpha01" But there is good news! The androidx.webkit package has recently worked on adding support for dark theming within WebViews – allowing us to provide a consistent dark theme experience throughout our application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |