I'm trying to load html with CSS which has ID selector and the file doesn't load to the webview as expected.
This is the file which I tried to load:
<!DOCTYPE html> <html> <head> <style> #para1 { text-align: center; color: red; } </style> </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html> However when I tried the code below,it loads to the webview.
<html> <head> <style> h1 {color:red;} p {color:blue;} </style> </head> <body> <h1>A heading</h1> <p>A paragraph.</p> </body> </html> I have enabled these properties on the WebView:
mWebView.setWebViewClient(new CustomWebViewClient()); mWebView.setWebChromeClient(new CustomWebChromeClient()); mWebView.getSettings().setSupportZoom(true); // ZoomControls mWebView.getSettings().setBuiltInZoomControls(true); // Multitouch mWebView.getSettings().setDisplayZoomControls(false); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setLoadWithOverviewMode(true); mWebView.getSettings().setUseWideViewPort(CONFIG.webviewEnableViewport()); mWebView.getSettings().setAllowFileAccess(true); mWebView.requestFocus(View.FOCUS_DOWN); mWebView.setHorizontalScrollBarEnabled(true); mWebView.setVerticalScrollBarEnabled(true); Can anyone help me on this?
not workingis a quite useless description for us. you need to be way more clear then that. What is not working? what is expected? what result do you get?