After buying RokcetWeb from codecanyon everything was working fine. But when I turn on the device as dark mode then my website also changes. How to disable it?
First of all, add this library to your project and sync. Please notice this is available from the upcoming version 1.3.6 or higher. So only needs to add this for below 1.3.6.
Then add this code to turn off the dark mode.
WebSettingsCompat.setForceDark(web_view.
settings
, WebSettingsCompat.
FORCE_DARK_OFF
)
Extra: There are 3 different constants available in WebSettingsCompat
to configure –
- FORCE_DARK_OFF – Disable the force dark mode for the webview, meaning the content of the webview will be rendered as-is
- FORCE_DARK_ON – Enable the force dark mode for the webview, meaning the content of the webview will always be rendered with a dark theme
- FORCE_DARK_AUTO – Enable the force dark mode for the webview depending on the state of the parent view, meaning that the system dark mode setting will be followed when rendering the content of the webview