一  TextView    父类 : View

    >概念:文本控件 :文本内容的显示   默认配置不可编辑  子类EditText可以编辑

*********************************

注意:安卓中如果在TextView中英文混用将有空可能自动折断到下行 ,如果是中文符号和英文混用将中文符号转换为半角。在安卓5.0后解决了这个BUG 或者删除 详情解决办法:http://niufc.iteye.com/blog/1729792

*********************************

>属性:



    android:text="你好,世界!"        文本内容

        android:textSize="20sp"   文本字体的大小

        android:textColor="#f00"  文本颜色

        android:textStyle="bold|italic"   文本字体样式   

        bold:加粗

italic:斜体

android:maxLength="1" 最大显示字符数

android:maxLines="2":文本最多展示的行数



       android:singleLine="true"    文本过多单行展示文本内容

        android:ellipsize="none"   省略号的位置

        none:  没有

        start:开始位置

        middle:中间位置

        end:结尾位置

        

        marquee:跑马灯



        跑马灯必要条件:

        android:singleLine="true"    单行展示

        android:ellipsize="marquee"  设置成跑马灯样式

        android:focusableInTouchMode="true"  设置获取焦点模式

        android:focusable="true"   设置获取焦点

        android:marqueeRepeatLimit="marquee_forever"   跑马灯无限循环



    android:autoLink="phone"自动链接  (根据内容不同  打开相应的程序)

          phone  电话

          web    网址

          map    地图

          email  邮箱

          all    以上所有





       设置阴影效果

        android:shadowColor="#0f0"   阴影的颜色

        android:shadowDx="10.0"     阴影水平偏移量

        android:shadowDy="8.0"      阴影垂直偏移量

android:shadowRadius="2"    阴影模糊程度   (值越大 越模糊)

<LinearLayout 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"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.fmy.img.MainActivity" > <!--
android:maxLength="1"设置最大字符数
android:textColor="#ff0000"设置颜色 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="1"
android:text="Hello wrold"
android:textColor="#ff0000" />
<!--
android:textColor="#ff0000"设置颜色
android:textStyle="italic|bold"设置斜体和加粗
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello wrold"
android:textColor="#ff0000"
android:textStyle="italic|bold" />
<!--
android:singleLine="true"设置单行
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold" />
<!--
android:maxLines="2"设置最大行数
android:ellipsize="middle"设置省略中间文字
android:ellipsize="start"设置省略开始文字
android:ellipsize="end"设置省略文字后端
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="start"
android:maxLines="2"
android:text="Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello 我是最后" />
<!--
ellipsize="marquee"设置跑马灯
设置跑马灯的前提:
focusableInTouchMode 设置焦点模式
marqueeRepeatLimit 设置跑马灯循环次数
singleLine="true"设置单行
focusable 获得焦点
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello wrold Hello 我是最后" />
<!--
android:autoLink="map"打开地图
android:autoLink="phone"打开text的电话
android:autoLink="web"打开text的网页
android:autoLink="email"设置text的邮箱链接到邮箱
android:text="635555698@qq.com"
-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="map"
android:text="635555698@qq.com" />
<!--
android:shadowDx="10" 设置阴影x离左上角的位置
android:shadowDy="10" 设置阴影y离左上角的位置
android:shadowRadius="2" 設置影印模糊度
-->
<TextView
android:shadowDx="10"
android:shadowDy="10"
android:shadowRadius="2"
android:shadowColor="#f00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="影音效果" /> </LinearLayout>

03安卓TextView的更多相关文章

  1. 解决安卓TextView异常换行,参差不齐等问题

    参考:http://blog.csdn.net/u012286242/article/details/28429267?utm_source=tuicool&utm_medium=referr ...

  2. 解决安卓TextView高度和textSize大小不一致问题

    在设计安卓界面的时候我发现一个TextView在布局上占用的高度和属性textSize的大小不一样,要比textSize要来的大(比如textSize="12dp",实际的高度大概 ...

  3. 安卓TextView限定行数最大值,点击按钮显示所有内容

    问题展示 如上图所示,在普通的TextView中,要求: 最多显示3行 超过三行显示展开按钮 且点击展开按钮显示完整内容 这个需求看似简单,但解决起来会遇到两个较为棘手的问题:1,如何判断是否填满了前 ...

  4. 安卓TextView完美展示html格式代码

    对于TextView展示html格式代码,最简单的办法就是使用textview.setText(Html.fromHtml(html));,即便其中有img标签,我们依然可以使用ImageGetter ...

  5. 安卓Textview的getLineCount返回0

    ViewTreeObserver observer = tv.getViewTreeObserver(); // textAbstract为TextView控件 observer.addOnGloba ...

  6. 安卓 textview 换行 不满就换了

    public static String ToDBC(String input) { char[] c = input.toCharArray(); for (int i = 0; i < c. ...

  7. TextView之富文本

    项目中使用富文本比较常见了,一行显示多种样式颜色的文本,使用 ClickableSpan 富文本实现在同一个 TextView 中的文本的颜色.大小.背景色等属性的多样化和个性化. 我们也可以使用Ht ...

  8. Json学习篇

      JSON的定义: 一种轻量级的数据交换格式,具有良好的可读和便于快速编写的特性.业内主流技术为其提供了完整的解决方案(有点类似于正则表达式 ,获得了当今大部分语言的支持),从而可以在不同平台间进行 ...

  9. 22个值得收藏的Android开源代码-UI篇

    本文介绍了android开发者中比较热门的开源代码,这些代码绝大多数可以直接应用到项目中. FileBrowserView 一个强大的文件选择控件.界面比较漂亮,使用也很简单.特点:可以自定义UI:支 ...

随机推荐

  1. 《Java技术》第二次作业--面向对象基础

    (一)学习总结 1.什么是构造方法?什么是构造方法的重载?下面的程序是否可以通过编译?为什么? public class Test { public static void main(String a ...

  2. c语言第二次作业2

    ---恢复内容开始--- (一)改错题 1.输出带框文字:在屏幕上输出以下3行信息. 源程序 对源程序进行编译 错误信息1: 错误原因:stdio.h输入错误 改正方法:i和d互换位置 错误信息2: ...

  3. Object Relational Tutorial 对象关系教程

    The SQLAlchemy Object Relational Mapper presents a method of associating user-defined Python classes ...

  4. 在 TensorFlow 中实现文本分类的卷积神经网络

    在TensorFlow中实现文本分类的卷积神经网络 Github提供了完整的代码: https://github.com/dennybritz/cnn-text-classification-tf 在 ...

  5. Intellij Error:Cannot build Artifact 'XXX:war exploded' because it is included into a circular dependency

    外网的流程是这样的. 1: 2: 3: 4: 基本按这个来就好了 如果到了build artfact哪里按钮是灰色 就要手动建了 https://jingyan.baidu.com/album/0a5 ...

  6. hibernate实体对象的三种状态:自由状态,持久状态,游离状态.

    自由态与游离态的区别: 当一个持久化对象,脱离开Hibernate的缓存管理后,它就处于游离状态,游离对象和自由对象的最大区别在于,游离对象在数据库中可能还存在一条与它 对应的记录,只是现在这个游离对 ...

  7. 函数的属性和方法之call、apply 及bind

    一.前言 ECMAScript中的函数是对象,因此函数也有属性和方法.每个函数都包含两个属性:length和prototype.每个函数也包含两个非继承来的方法:apply()和call(),还有一些 ...

  8. 15. 3Sum(中等)

    Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...

  9. ArrayList源码和多线程安全问题分析

    1.ArrayList源码和多线程安全问题分析 在分析ArrayList线程安全问题之前,我们线对此类的源码进行分析,找出可能出现线程安全问题的地方,然后代码进行验证和分析. 1.1 数据结构 Arr ...

  10. kafka topic 相关操作

    1.列出集群中的topic bin/kafka-topics.sh --zookeeper spark1:2181,spark2:2181,spark3:2181 --list 2.创建topic r ...