0

I am using WebView in my Android app. When I click on a select, a window with the select options is displayed, but the options color and background is both white, so they cannot be read, how can I change this style? If I open the same website on the regular Android browser then the options are rendered properly, So I'm guessing this is a problem with my styling, but I cannot pinpoint which style option is the one responsible.

Note that this is not a listview, but a regular web browser select popup dialog.

MichelReap
  • 5,630
  • 11
  • 37
  • 99

1 Answers1

0

@Andrew Dashin(https://stackoverflow.com/a/8369422/720097):

You could use WebView.loadDataWithBaseURL

htmlData = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + htmlData;
// lets assume we have /assets/style.css file
webView.loadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "UTF-8", null);

And only after that WebView will be able to find and use css-files from the assets directory.

ps And, yes, if you load your html-file form the assets folder, you don't need to specify a base url.

Community
  • 1
  • 1
Alexander.Iljushkin
  • 4,519
  • 7
  • 29
  • 46