widget(1、TextView)

TextView 是android基本的控件,用以显示一个静态文本框。

  • 通常定义如下:
    <TextView
        android:id="@+id/text_test"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />
  • 常用API如下:
textview.setAutoLinkMask(Linkify.WEB_URLS);
        
textview.setTextColor(Color.rgb(0, 200, 155));
        
textview.setText("http://www.sohu.com");//设置文本内容    

其中setAutoLinkMask是将该文本区域编程一个链接,类似href,在此设置下setTextColor无效。

posted @ 2013-01-23 20:23  Fredric_2013  阅读(201)  评论(0编辑  收藏  举报