Android组件 文字标签(TextView)

来源:互联网 发布:js div style display 编辑:程序博客网 时间:2024/05/23 21:15

/android_TextView/res/layout/main.xml代码如下:

[html] view plaincopy
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="fill_parent"  
  4.     android:layout_height="fill_parent"  
  5.     android:orientation="vertical"   
  6.     android:background="#ffF4F4F4"  
  7.     android:padding="8dip">  
  8.       
  9.     <!-- 文字居中效果 -->  
  10.     <TextView  
  11.         android:layout_width="fill_parent"  
  12.         android:layout_height="wrap_content"  
  13.         android:text="文字居中"   
  14.         android:gravity="center"  
  15.         android:background="#ff00ff00"  
  16.         android:textColor="#ff000000"/>  
  17.       
  18.     <!-- 文字跑马灯效果 -->  
  19.     <TextView   
  20.         android:layout_width="100dip"  
  21.         android:layout_height="wrap_content"  
  22.         android:text="文字跑马灯效果"  
  23.         android:ellipsize="marquee"  
  24.         android:marqueeRepeatLimit="marquee_forever"  
  25.         android:singleLine="true"  
  26.         android:focusable="true"  
  27.         android:focusableInTouchMode="true"  
  28.         android:textColor="#ff000000"/>  
  29.       
  30.     <!-- 文字阴影效果 -->  
  31.     <TextView   
  32.         android:layout_width="fill_parent"  
  33.         android:layout_height="wrap_content"  
  34.         android:text="文字阴影效果"  
  35.         android:textColor="#ff000000"  
  36.         android:shadowColor="#ffff0000"  
  37.         android:shadowRadius="3.0"/>  
  38.       
  39.     <!-- 网址超链接效果 -->  
  40.     <TextView   
  41.         android:layout_width="fill_parent"  
  42.         android:layout_height="wrap_content"  
  43.         android:text="网址:http://www.baidu.com"  
  44.         android:textColor="#ff000000"  
  45.         android:autoLink="all"   
  46.         android:textColorLink="#ff0000ff"/>  
  47.       
  48.     <!-- 文字超链接效果 -->  
  49.     <TextView   
  50.         android:layout_width="fill_parent"  
  51.         android:layout_height="wrap_content"  
  52.         android:text="@string/txtlink"  
  53.         android:textColor="#ff000000"/>  
  54.       
  55.     <!-- 电话超链接效果 -->  
  56.     <TextView   
  57.         android:layout_width="fill_parent"  
  58.         android:layout_height="wrap_content"  
  59.         android:text="@string/tellink"  
  60.         android:textColor="#ff000000"/>  
  61.       
  62.     <!-- 字形效果 -->  
  63.     <TextView   
  64.         android:layout_width="fill_parent"  
  65.         android:layout_height="wrap_content"  
  66.         android:text="斜体"  
  67.         android:textColor="#ff000000"  
  68.         android:textStyle="italic"/>  
  69.       
  70.     <!-- 文字缩放效果 -->  
  71.     <TextView   
  72.         android:layout_width="fill_parent"  
  73.         android:layout_height="wrap_content"  
  74.         android:text="文字缩放 0.5f"  
  75.         android:textColor="#ff000000"  
  76.         android:textScaleX="0.5"/>  
  77.       
  78.     <TextView   
  79.         android:layout_width="fill_parent"  
  80.         android:layout_height="wrap_content"  
  81.         android:text="文字缩放 1.0f"  
  82.         android:textColor="#ff000000"  
  83.         android:textScaleX="1.0"/>  
  84.       
  85.     <TextView   
  86.         android:layout_width="fill_parent"  
  87.         android:layout_height="wrap_content"  
  88.         android:text="文字缩放 1.5f"  
  89.         android:textColor="#ff000000"  
  90.         android:textScaleX="1.5"/>  
  91.       
  92.     <TextView   
  93.         android:layout_width="fill_parent"  
  94.         android:layout_height="wrap_content"  
  95.         android:text="文字缩放 2.0f"  
  96.         android:textColor="#ff000000"  
  97.         android:textScaleX="2.0"/>  
  98.       
  99.     <TextView   
  100.         android:layout_width="fill_parent"  
  101.         android:layout_height="wrap_content"  
  102.         android:text="文字缩放 2.5f"  
  103.         android:textColor="#ff000000"  
  104.         android:textScaleX="2.5"/>  
  105.       
  106.     <!-- 设置行间距 -->  
  107.     <TextView   
  108.         android:layout_width="fill_parent"  
  109.         android:layout_height="wrap_content"  
  110.         android:text="@string/lineheight1"  
  111.         android:textColor="#ff000000"  
  112.         android:lineSpacingExtra="4sp"/>  
  113.       
  114.     <!-- 设置行间距的倍数 -->  
  115.     <TextView   
  116.         android:layout_width="fill_parent"  
  117.         android:layout_height="wrap_content"  
  118.         android:text="@string/lineheight2"  
  119.         android:textColor="#ff000000"  
  120.         android:lineSpacingMultiplier="1.5"/>  
  121. </LinearLayout>  

转自:http://blog.csdn.net/a8671991/article/details/7399821

原创粉丝点击