android学习笔记17:文字设置

48 篇文章 0 订阅

在Android文字可以设置的属性包括大小,颜色,是否是密码,是否显示阴影,超链接,文字无法显示的时候的省略规则等。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	>
	<!-- 设置字体为20pt  -->
	<TextView
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content" 
	android:text="我爱yanzi"
	android:textSize="20pt"
	/>
	<!-- 设置中间省略 -->
	<TextView
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content"
	android:singleLine="true" 
	android:text="我爱yanzi我爱yanzi我爱yanzi我爱yanzi我爱yanzi我aaayanzi"
	android:ellipsize="middle"
	/>
	<!-- 对网址增加链接 -->
	<TextView
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content"
	android:singleLine="true" 
	android:text="测试http://blog.csdn.net/hn307165411内容"
	android:autoLink="all"
	/>
	<!-- 设置文字颜色 、大小,并使用阴影 -->
	<TextView
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content" 
	android:text="测试文字"
	android:shadowColor="#0000ff"
	android:shadowDx="15.0"
	android:shadowDy="20.0"
	android:shadowRadius="45.0"
	android:textColor="#ff0000"
	android:textSize="25pt"
	/>
	<!-- 测试密码框 -->
	<TextView android:id="@+id/passwd"
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content" 
	android:text="@string/hello"
	android:password="true"
	/>
</LinearLayout>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值