UI组件:TextView及其子类讲述.doc

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
UI组件:TextView及其子类讲述

UI组件:TextView及其子类 TextView的功能与用法 TextView直接继承了View,它还是EditView,Button两个UI组件的父类。 TextView与EditView有很多相似之处,他们之间的最大区别是EditView允许用户编辑编辑文本内容,而TextView不允许。 TextView提供了大量的XML属性,这些属性不仅适用于TextView,TextView的子类也同时适用。 TextView的XML属性 下面列举了TextView一些常用的XML属性及相关方法的说明: CheckedTextView的功能与用法 TextView派生出了一个CheckedTextView,CheckTextView增加了一个checked状态。 通过setChecked(boolean)和isChecked()方法来改变、访问该组件的checked状态。 通过setCheckMarkDrawable()方法来设置它的勾选图标。 TextView和 CheckedTextView的基本实例 ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=/apk/res/android xmlns:tools=/tools android:id=@+id/activity_main android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical tools:context=com.example.textviewinfo.MainActivity !--设置字体大小为20sp,文本框右边绘制图片,文本内间距为10dp-- TextView android:id=@+id/text android:layout_width=match_parent android:layout_height=wrap_content android:padding=10dp android:textSize=20sp android:drawableRight=@drawable/picture android:text=文本结尾绘制一张图片/ !--设置文本行数为1,文本结尾省略显示-- TextView android:layout_width=match_parent android:layout_height=wrap_content android:lines=1 android:ellipsize=end android:text=长文本长文本长文本长文本长文本长文本长文本长文本长文本长文本长文本长文本/ !--对邮件、电话添加链接-- TextView android:layout_width=match_parent android:layout_height=wrap_content android:layout_marginTop=10dp android:autoLink=email|phone android:text=邮件是kongyeeku@163.com,电话是16839323939/ !--设置文本颜色,大小,上边距为10dp,并使用阴影-- TextView android:layout_width=match_parent android:layout_height=wrap_content android:layout_marginTop=10dp android:shadowColor=#3F51B5 android:shadowDx=10.0 android:shadowDy=8.0 android:shadowRadius=3.0 android:text=带有阴影的文字/ !--测试密码框-- TextView android:layout_width=match_parent android:layout_height=wrap_content a

文档评论(0)

jiayou10 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8133070117000003

1亿VIP精品文档

相关文档