Android TextView Justify Text Text Text View適応テキスト



1
 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" , "utf-8" );

<string
 

name = "hello" >
<![CDATA[

<html> <head></head>
<body style = " text - align : justify ; color : gray ; background - color : black ; " >
  Lorem ipsum dolor sit amet, consectetur
  adipiscing elit. Nunc pellentesque, urna
  nec hendrerit pellentesque, risus mass

</body>
</html> ]]> </string>




2:

  

Spanned
content = Html . fromHtml
(
"<div style=/"text-align:justify/">"   + bundle .getString ( CONTENT ) + "<//div>" );

TextView txtContent = ( TextView ) findViewById ( R . id . txtNewsDetail );

txtContent . setText ( content . toString (), BufferType . SPANNABLE );