Load HTML file to WebView with custom CSS

前端 未结 1 1889
余生分开走
余生分开走 2021-01-22 04:09

I have a WebView on my Android application which loads (WebView.loadUrl()) different local HTML files from phone\'s internal storage. I would like to include some c

1条回答
  •  说谎
    说谎 (楼主)
    2021-01-22 04:36

    One possibility (I have not tried this):

    WebView.loadDataWithBaseURL(String baseUrl, String data, ..)

    takes a baseURL for the document to use to resolve relative URLs. Take a look at the CSS url and construct baseURL so that CSS url will reference local CSS file.

    0 讨论(0)
提交回复
热议问题