Android软件开发之TextView详解

雨松MOMO原创文章如转载,请注明:转载自雨松MOMO的博客原文地址:http://blog.csdn.net/xys289187120/article/details/6625662

1.TextView中链接手机号码/网页/邮件/地图


android:autoLink的可选值为(none/web/email/phone/map/all) 设置一个URL链接 ,可以点击访问。

例如:android:text="拨打手机:13888888888"
android:autoLink="phone"

这里设置了一个链接为手机的autoLink 它会自动设别数字 过滤掉字符串"拨打手机:" 从而点击号码后会转跳到系统拨号码的界面可以拨打电话。

拨打手机号码:

<TextView android:id="@+id/textView0" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FF0000" android:textSize="18dip" android:background="#FFFFFF" android:text="拨打手机:13888888888" android:gravity="center_vertical|center_horizontal" android:autoLink="phone" />
访问web网页:

<TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FF0000" android:textSize="18dip" android:background="#00FF00" android:text="雨松MOMO的博客:http://blog.csdn.net/xys289187120" android:gravity="center_vertical|center_horizontal" android:autoLink="web" />

发送邮件:

首选须要设置自己的电子邮件 否则Android是不知道你从那里发的邮件

<TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#FF0000" android:textSize="18dip" android:background="#FFFF00" android:text="发送邮件:xuanyusong@gmail.com" android:gravity="center_vertical|center_horizontal" android:autoLink="email" />

谷歌地图:

设置android:autoLink="map"后需要有google地图才可以 否则会报错


2.在TextView中显示图片

通过设置背景的方式显示
android:background="@drawable/icon"

设置图片在textView的锚点位置
android:drawableBottom="@drawable/icon"
android:drawableTop="@drawable/icon"
android:drawableLeft="@drawable/icon"
android:drawableRight="@drawable/icon"

<TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="在图片下方" android:textColor="#FF0000" android:drawableBottom="@drawable/jay" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" > </TextView> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="在图片上方" android:textColor="#FF0000" android:drawableTop="@drawable/jay" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" > </TextView> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="在图片左边" android:textColor="#FF0000" android:drawableLeft="@drawable/jay" android:layout_alignParentLeft="true" android:layout_centerVertical="true" > </TextView> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="在图片右边" android:textColor="#FF0000" android:drawableRight="@drawable/jay" android:layout_alignParentRight="true" android:layout_centerVertical="true" > </TextView>

3.文本显示内容的处理

可以在textView中设置我们想要的任何效果

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="18dip" android:background="#00FF00" android:text="文本内容" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置字符串显示为*" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置字符串显示为*" android:password="true" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FF0000" android:textColor="#FFFFFF" android:text="设置字符串阴影颜色" android:shadowColor="#000000" android:shadowRadius="3.0" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:singleLine="true" android:text="只显示一行字符串超出屏幕为'...'dsfusdiofjdsiofjsdiofjoisdjfiosdjfoisdjfoisdf" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FF0000" android:textColor="#FFFFFF" android:text="设置显示文字的间隔为0.5" android:textScaleX="0.5" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FF0000" android:textColor="#FFFFFF" android:text="设置显示文字的间隔为2.0" android:textScaleX="2.0" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字外形为 bold" android:textStyle="bold" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字外形为 normal" android:textStyle="normal" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="18dip" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字外形为 italic" android:textStyle="italic" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字大小 为10" android:textSize="10dip" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字大小 为15" android:textSize="15dip" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:textColor="#FF0000" android:text="设置文字大小 为20" android:textSize="20dip" android:gravity="center_vertical|center_horizontal" /> <TextView android:layout_width="200px" android:layout_height="wrap_content" android:textSize="18dip" android:ellipsize="marquee" android:focusable="true" android:marqueeRepeatLimit="marquee_forever" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:text="文字滚屏文字跑马灯效果加长加长加长加长加长加长加长加长加长加长加长加长" android:background="#FF0000" android:textColor="#FFFFFF" > </TextView>

最后如果你还是觉得我写的不够详细 看的不够爽 不要紧我把源代码的下载地址贴出来 欢迎大家一起讨论学习
雨松MOMO希望可以和大家一起进步。

下载地址:http://download.csdn.net/source/3461603

Android软件开发之TextView详解(六)相关推荐

  1. android软件开发之webView.addJavascriptInterface循环渐进【二】

    说明 文章列表 android软件开发之webView.addJavascriptInterface循环渐进[一]: http://www.sollyu.com/android-software-de ...

  2. JAVAWEB开发之Hibernate详解(三)——Hibernate的检索方式、抓取策略以及利用二级缓存进行优化、解决数据库事务并发问题

    Hibernate的检索方式  Hibernate提供了以下几种检索对象的方式: 导航对象图检索方式:根据已经加载的对象导航到其他对象. OID检索方式:按照对象的OID来检索对象. HQL检索方式: ...

  3. Android开发之Services详解

    在百度文库看到一篇文章讲解Services,非常详细,记录于此,方便以后查看. 百度文库地址:http://wenku.baidu.com/view/58dbf82bcfc789eb172dc8d8. ...

  4. Android开发之InstanceState详解

    本文介绍Android中关于Activity的两个神秘方法:onSaveInstanceState() 和 onRestoreInstanceState(),并且在介绍这两个方法之后,再分别来实现使用 ...

  5. Android开发之SurfaceView详解

    文章转自csdn,感觉作者也是将网上的文章拼凑起来的,所以有时候上下文衔接不是很好. SurfaceView介绍 通常情况程序的View和用户响应都是在同一个线程中处理的,这也是为什么处理长时间事件( ...

  6. ANDROID开发之SQLite详解

    SQLite简介 Google为Andriod的较大的数据处理提供了SQLite,他在数据存储.管理.维护等各方面都相当出色,功能也非常的强大.SQLite具备下列特点: 1.轻量级 使用 SQLit ...

  7. android开发之shape详解

    很多时候,使用shape能够实现的效果,你用一张图片也能够实现,但问题是一张图片无论你怎么压缩,它都不可能比一个xml文件小,因此,为了获得一个高性能的手机App,我们在开发中应该遵循这样一个原则:能 ...

  8. Android开发之SoundPool详解

    1. 创建一个SoundPool (构造函数) public SoundPool(int maxStream, int streamType, int srcQuality)  maxStream - ...

  9. JAVAWEB开发之Spring详解之——Spring的入门以及IOC容器装配Bean(xml和注解的方式)、Spring整合web开发、整合Junit4测试

    Spring框架学习路线 Spring的IOC Spring的AOP,AspectJ Spring的事务管理,三大框架的整合 Spring框架概述 什么是Spring?  Spring是分层的Java ...

最新文章

  1. 入门 | 无人驾驶汽车系统基本框架梳理
  2. poi 拆分带图片的word_学会这2招,再多的“表格编号”都能轻松解决!【Word教程】...
  3. 简单的busybox创建_用Busybox创建文件系统
  4. 为什么auto_ptr智能指针不能作为STL标准容器的元素
  5. javascript检测浏览器类型和版本号(兼容各浏览器)
  6. java 接口可以被继承_接口能被继承吗?
  7. accp8.0转换教材第6章连接MySQL理解与练习
  8. 吴恩达教授机器学习课程笔记【四】- 生成学习算法(1)高斯判别分析模型
  9. 交叉验证与训练集、验证集、测试集
  10. 【前端切图】用css画一个卡通形象-小猪佩奇
  11. Linux内核源码分析
  12. java读取字符串分离单词_从Java中的字符串中提取第一个单词的最佳方法是什么?...
  13. 接口测试流程和用例设计
  14. lldp协议代码阅读_LLDP - 小蚂蚁_CYJ - 博客园
  15. epcs1s是epcs1系列的么_串行FLASH配置芯片(EPCS1或EPCS4)数据手册
  16. 【计算机网络】数字签名和数字认证
  17. 抖音中用小程序自动制作人物关系图
  18. 《Struts2 In Action》摘录
  19. 基于ResNetRS的宝可梦图像识别
  20. Vue进阶(八十二):updated 应用详解

热门文章

  1. AFPM100/B消防设备电源监控系统在安阳林州人民广场的应用
  2. python机器学习 | K近邻算法学习(1)
  3. Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images
  4. 基本 UNIX 指令
  5. 汽车理论:燃油经济性
  6. 全国计算机word第八题,全国计算机等级考试一级上机WORD题(八)
  7. 南阳779 兰州烧饼
  8. Google 宣布将 Istio 商标转让给 Open Usage Commons 组织
  9. 攻击工具SYN Flood的源代码
  10. CI中使用memcached