Looking to display HTML content with CSS styling stored in a file downloaded from a URL and saved within the "context.filesDir". The downloaded folder contains all the assets required by the CSS file. Despite passing the CSS file path to the webview, only plain HTML text is visible.
The path for the CSS file has been confirmed to exist, as seen in Device Explorer:
File(context.filesDir.path+"/v4/v4/c/", "mobil-app.css").path
In my HTML, I have created a <link> tag for the stylesheet href:
val html = "...<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///data/user/0/<package-name>/files/v4/v4/c/mobil-app.css\"/>...
I then tried calling the webview object with the .loadWithBaseURL() method, but the CSS does not apply. Attempts include using:
loadDataWithBaseURL(null, html, "text/html; charset=utf-8", "UTF-8", null)
and
loadDataWithBaseURL("file:///data/data/<package-name>/files/v4/v4/c/.", html, "text/html; charset=utf-8", "UTF-8",null)
Yet, no changes are observed. Can anyone assist in identifying what may be missing here?