Sunday 31 March 2013

android: View Html and JavaScript in WebView


WebView htmlWebView = (WebView) findViewById(R.id.webView1);     

try {
     htmlWebView.getSettings().setPluginState(PluginState.ON);
   //presentationWebView.getSettings().setPluginsEnabled(true);
     htmlWebView.getSettings().setJavaScriptEnabled(true);
     htmlWebView.getSettings().setLoadWithOverviewMode(true);
     htmlWebView.getSettings().setAllowFileAccess(true);      
     htmlWebView.loadUrl("file:///android_asset/htmldatat/index.html");  
     htmlWebView.setWebViewClient(new WebViewClient(){
              @Override                public boolean shouldOverrideUrlLoading(WebView view, String url)      

             {
                return false;
                    }
           });
    htmlWebView.getSettings().setBuiltInZoomControls(true);                         

} catch (Exception e) {
     e.printStackTrace();
}

Thursday 21 March 2013

Android ems

It is the width of the letter M in a given english font size. So 2em is twice the width of the letter M in this given font. In font differ from english it is the width of the widest letter in this font, this width is different size in pixels then the width size of the M in the english font but it is still 1em. So if I use text with 12sp in english font 1em is relative to this 12sp english font, using Italian font with 12sp gives 1em that is differ in pixels width then the english one.

Monday 18 March 2013