Android TextView Justify Text

前端 未结 29 1180
滥情空心
滥情空心 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:15

    To justify text in android I used WebView

        setContentView(R.layout.main);
    
        WebView view = new WebView(this);
        view.setVerticalScrollBarEnabled(false);
    
        ((LinearLayout)findViewById(R.id.inset_web_view)).addView(view);
    
        view.loadData(getString(R.string.hello), "text/html; charset=utf-8", "utf-8");
    

    and html.

    
    
     
     
      Lorem ipsum dolor sit amet, consectetur 
      adipiscing elit. Nunc pellentesque, urna
      nec hendrerit pellentesque, risus massa
     
    
    ]]>
    
    

    I can't yet upload images to prove it but "it works for me".

提交回复
热议问题