1 / 21
文档名称:

(安卓开发技术课件)20TextView讲解[精].pptx

格式:pptx   大小:2,601KB   页数:21页
下载后只包含 1 个 PPTX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

(安卓开发技术课件)20TextView讲解[精].pptx

上传人:yzhqw888 2018/2/5 文件大小:2.54 MB

下载得到文件列表

(安卓开发技术课件)20TextView讲解[精].pptx

相关文档

文档介绍

文档介绍:Android开发技术
TextView讲解
主要内容
TextView简介
TextView常用属性
TextView使用方式
TextView与string及dimen资源的结合使用
pleteTextView的使用方式
TextView讲解
TextView简介
TextView讲解
TextView就是一个用来显示文本标签的控件,如下图所示
TextView的常用属性
TextView讲解
属性名称
描述
android:maxLength
限制字符的长度
android:lines
设置文本的行数
android:maxLines
设置文本的最大显示行数
android:minLines
设置文本的最小行数
android:lineSpacingExtra
设置行间距
android:singleLine
设置单行显示
android:textColor
设置文本颜色
android:textColorHighlight
被选中文字的底色,默认为蓝色
android:textColorLink
文字链接的颜色
TextView的常用属性
TextView讲解
属性名称
说明
android:background
设置TextView的背景
android:textScaleX
设置文字之间间隔,
android:textSize
设置文字大小
android:textStyle
设置字形
android:ellipsize
设置当文字过长时,该控件该如何显示
android:autoLink
当文本为URL链接/email/电话号码/map时,文本显示为可点击的链接
android:includeFontPadding
文本是否包含顶部和底部额外空白,默认为true
案例一说明
TextView讲解
案例说明:创建一个有背景的TextView,字体为蓝色,如下
图所示
案例一项目布局
TextView讲解
<RelativeLayout xmlns:android="http://schemas./apk/res/android"
xmlns:tools="http://schemas./tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width=" match_parent "
android:layout_height=" match_parent "
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="站在花开的树下"
android:textColor="#4169e1"
android:textSize="30sp"
android:background="***@drawable/e"
/>
</RelativeLayout>
案例二说明及项目布局
TextView讲解
案例说明:实现一个带有跑马灯效果的TextView
项目布局:
<RelativeLayout xmlns:android="http://schemas./apk/res/android"
xmlns:tools="http://schemas./tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:layout_width="60dip"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="我是一个TextView的跑马灯效果"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="