你好,游客 登录 注册 搜索
背景:
阅读新闻

Android之路-TextView组件

[日期:2011-12-14] 来源:Linux社区  作者:xyf28190374 [字体:大 中 小]

2、auto_link.xml文件

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="match_parent"  
  5.     android:orientation="vertical" >  
  6.   
  7.     <TextView  
  8.         android:layout_width="fill_parent"  
  9.         android:layout_height="wrap_content"  
  10.         android:autoLink="web"  
  11.         android:text="@string/webUrl" />  
  12.     <TextView  
  13.         android:layout_width="fill_parent"  
  14.         android:layout_height="wrap_content"  
  15.         android:autoLink="email"  
  16.         android:text="@string/email" />  
  17.     <TextView  
  18.         android:layout_width="fill_parent"  
  19.         android:layout_height="wrap_content"  
  20.         android:autoLink="phone"  
  21.         android:text="@string/phoneNumber" />  
  22.        <TextView  
  23.            android:id="@+id/tvHtml"  
  24.         android:layout_width="fill_parent"  
  25.         android:layout_height="wrap_content"  
  26.  />  
  27.   
  28. </LinearLayout>  

这个文件简单的说明了超链接(auto_link)的使用方法,每种链接都有自己的格式,如果格式错误,不能链接

3、strings.xml文件

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <resources>  
  3.   
  4.     <string name="hello">Hello World, TextViewTestActivity!</string>  
  5.     <string name="app_name">TextViewTest</string>  
  6.     <string name="webUrl">凤凰网:http://www.ifeng.com</string>  
  7.     <string name="email">小强的邮箱:1234abc@163.com</string>  
  8.     <string name="phoneNumber">电话号码:1383838438</string>  
  9.      
  10. </resources>  

模拟��显示效果:

linux
相关资讯       Android开发教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款