How to implement CSS file in Android App

Here is the simplest way to implement your CSS file in android application.

WebViews in your native Android app, to display HTML which is packaged with the app, then you can use CSS like in any HTML site.

WebVie webView=(WebView) findViewById(R.id.webViewDetials);
//webView.setBackgroundColor(0x00000000);
webView.getSettings().setJavaScriptEnabled(true);

StringBuilder sb = new StringBuilder();
sb.append("<HTML><HEAD><LINK href=\"http://google.com/css/attribute.css\" type=\"text/css\" rel=\"stylesheet\"/></HEAD><body>");
sb.append(attributes.toString());
sb.append("</body></HTML>");
webView.loadDataWithBaseURL(null, sb.toString(), "text/html", "utf-8", null);

Happy Coding!!!
How to implement CSS file in Android App How to implement CSS file in Android App  Reviewed by D Kshetri on 8:06 PM Rating: 5

No comments:

Powered by Blogger.