Justifying text in Android

后端 未结 6 687
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-20 01:42

I need to justify some text (RTL), which is a string (S1) from the server. But a TextView can\'t justify text, so I have to use a WebView

6条回答
  •  粉色の甜心
    2020-12-20 01:53

    Use web view

      WebView tv = (WebView) findViewById(R.id.aboutme); 
      String youtContentStr = String.valueOf(Html
                            .fromHtml(""
                                        + text
                                        + "]]>"));
    
      tv.setBackgroundColor(Color.TRANSPARENT);
      tv.loadData(youtContentStr, "text/html", "utf-8");`
    

提交回复
热议问题