Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • justify text in android using webview

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.87k
    Comment on it

    Android does not support justification of text,but we can achieve this using loading the text in WebView.

    String youtContentStr = String.valueOf(Html
            .fromHtml("<![CDATA[<body style=\"text-align:justify;color:#222222; \">"
                    + getResources().getString(R.string.app_name)
                    + "</body>]]>"));
    WebView webView=(WebView)findViewById(R.id.webview);
    webView.loadData(youtContentStr, "text/html; charset=utf-8","UTF-8");

    Thanks.

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: