Android TextView Justify Text

前端 未结 29 1211
滥情空心
滥情空心 2020-11-22 03:28

How do you get the text of a TextView to be Justified (with text flush on the left- and right- hand sides)?

I found a possible solution here, but it do

29条回答
  •  心在旅途
    2020-11-22 04:00

    XML Layout: declare WebView instead of TextView

    
    

    Java code: set text data to WebView

    WebView view = (WebView) findViewById(R.id.textContent);
    String text;
    text = "

    "; text+= "This is the text will be justified when displayed!!!"; text+= "

    "; view.loadData(text, "text/html", "utf-8");

    This may Solve your problem. Its Fully worked for me.

提交回复
热议问题