标签:des android style blog http io color os ar
1.概要:
1 public class MainActivity extends Activity { 2 3 private TextView text1, text2; 4 5 @Override 6 protected void onCreate(Bundle savedInstanceState) { 7 super.onCreate(savedInstanceState); 8 setContentView(R.layout.activity_main); 9 text1 = (TextView) findViewById(R.id.first); 10 text2 = (TextView) findViewById(R.id.second); 11 // 设置超链接 12 text1.setText(Html 13 .fromHtml("Visit <a href=\"http://qq.com\">QQ home page</a>")); 14 text1.setMovementMethod(LinkMovementMethod.getInstance()); 15 16 // 文本设置高亮 17 SpannableString ss = new SpannableString( 18 "Android开发技巧,Android开发技巧,Android开发技巧,Android开发技巧,Android开发技巧,"); 19 ss.setSpan(new BackgroundColorSpan(Color.RED), 1, 4, 0); 20 ss.setSpan(new ForegroundColorSpan(Color.BLUE), 5, 9, 0); 21 text2.setText(ss); 22 } 23 24 }
标签:des android style blog http io color os ar
原文地址:http://www.cnblogs.com/liangstudyhome/p/4059796.html