标签:android style class blog code java
<string name= "text1" ><![CDATA[ Visit <a href=\"http://blog.csdn.net/vector_yi\">Vector_Yi\‘s Blog</a> ]]></string>
final TextView textView1 = (TextView ) findViewById( R. id. my_text_view_html); textView1 .setText (Html . fromHtml( getString( R. string. text1))); textView1 .setMovementMethod (LinkMovementMethod . getInstance());
<string name= "text2" >Hello World, HomeActivity!</string>
final Spannable text2 = new SpannableString( getString (R .string .text2 )); text2 .setSpan ( new BackgroundColorSpan( Color. RED), 1 , 4, 0 );//从index为1起,到index为4止,设置背景色为RED text2 .setSpan ( new ForegroundColorSpan( Color. BLUE), 6 , 9, 0 );
50个Android开发技巧(10 为TextView加入样式),布布扣,bubuko.com
50个Android开发技巧(10 为TextView加入样式)
标签:android style class blog code java
原文地址:http://www.cnblogs.com/mengfanrong/p/3807833.html