1.3TextView

TextView主要用来显示丰富的文本信息,也可以用来显示图文并茂的混排页面。

android:text 设置文本内容 @string/xx
android:textColor 设置文本字体颜色 RGB的形式

android:textStyle 设置文本字体样式 bold表示加粗 italic表示斜体 设置多个用 | 隔开

android:textSize 设置文本字体大小 单位使用sp(缩放像素)
android:singleLine 设置文本是否单行展示

android:autoLink 给指定的文本增加可点击的超链接
-none
-map
-all
-phone
-web
-email 设置多个用 | 隔开

android:drawableTop 表示设置TextView控件上方显示的图片 @drawable/xx
android:drawableBottom
android:drawableLeft
android:drawableRight

在这里插入图片描述

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
 >

    <TextView
        android:id="@+id/tv01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" 
        android:textColor="#aa0000"
        android:textSize="25sp"
        android:textStyle="bold|italic"
        android:singleLine="true"
        android:drawableTop="@drawable/abc_ic_voice_search"
        
        
        />
    
    <TextView
        android:id="@+id/tv02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/phone"
        android:layout_below="@+id/tv01"
        android:autoLink="phone"
 
        />
    
     <TextView
        android:id="@+id/tv03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/web"
        android:layout_below="@+id/tv02"
        android:autoLink="web"
 
        />
     
     <TextView
        android:id="@+id/tv04"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/email"
        android:layout_below="@+id/tv03"
        android:autoLink="email"
 
        />

</RelativeLayout>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值