`
talin2010
  • 浏览: 503131 次
  • 性别: Icon_minigender_1
  • 来自: 河北
社区版块
存档分类
最新评论

Android TextView Justify Text TextView自适应文本

阅读更多

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 );





分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics