<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.prize.mydemo1.Main4Activity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!--TextView 放入图片例子-->
        <!--android:drawableTop="@drawable/icon1"  在文字上面放入图片-->
        <!--android:drawablePadding="20dp"  设置图片与文字之间的间隔-->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="努力学习"
            android:textColor="#0000ff"
            android:textSize="50sp"
            android:drawableTop="@drawable/icon1"
            android:drawablePadding="20dp"
            />
        <!--文字太长显示省略。。。例子-->
        <!--android:maxLines="1"  设置TextView行数-->
        <!--android:ellipsize="end"  设置文本结尾显示。。。-->
        <!--android:layout_marginBottom="5dp" 设置布局间隔-->
        <TextView
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="@string/main4Text1"
            android:maxLines="1"
            android:ellipsize="end"
            android:layout_marginBottom="5dp"/>
        <!--android:ellipsize="end"  设置文本中间显示省略。。。-->
        <TextView
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="@string/main4Text1"
            android:maxLines="1"
            android:ellipsize="middle"/>
        <!--设置有滚动播放效果的文字显示-->
        <!--android:singleLine="true"  设置单行-->
        <!--android:marqueeRepeatLimit="marquee_forever"  设置滚动次数,这里为永久滚动-->
        <!--android:ellipsize="marquee"  ellipsize意思省略位置,marquee的意思是滚动模式-->
        <!--android:focusable="true"  意思可聚焦,被选中。只有聚焦的文字才会滚动-->
        <!--android:focusableInTouchMode="true"   可调焦的触摸模式-->
        <!--注意此方法设置文字滚动,一个页面只有一段文字可以被预设聚焦并且滚动-->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/main4Text1"
            android:layout_marginTop="30dp"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:focusable="true"
            android:focusableInTouchMode="true"/>

    </LinearLayout>

</LinearLayout>

运行效果:

android TextView 例子代码(文字图片、文字省略、文字滚动)的更多相关文章

  1. android TextView 例子代码(文字中划线、文字下划线)

    XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  2. Android TextView 显示HTML加图片

    TextView显示网络图片,我用android2.3的系统,可以显示图片出来,并且如果图片比较大,应用会卡的现象,肯定是因为使用主线程去获取网络图片造成的,但如果我用android4.0以上的系统运 ...

  3. Android TextView里直接显示图片的三种方法

    方法一:重写TextView的onDraw方法,也挺直观就是不太好控制显示完图片后再显示字体所占空间的位置关系.一般假设字体是在图片上重叠的推荐这样写.时间关系,这个不付源代码了. 方法二:利用Tex ...

  4. Android:Textview 通过代码设置 Drawable

    解决方案 public void setCompoundDrawables (Drawable left, Drawable top, Drawable right, Drawable bottom) ...

  5. jquery文字上下滚动--单行 批量多行 文字图片上下翻滚 | 多行滚动

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. Android TextView 嵌套图片及其点击,TextView 部分文字点击,文字多颜色

    1. TextView 中嵌套图片的方法 TextView textView... textView.setText("..."); textView.append(Html.fr ...

  7. Android TextView中有图片有文字混合排列

    Android TextView中有图片有文字混合排列 1.使用html.fromHtml 2.新建ImageGetter 3.使用<img src>标签 demo: 1.设置文字 ((T ...

  8. android 文字图片合成

    引用:http://blog.csdn.net/cq361106306/article/details/8142526 两种方法: 1.直接在图片上写文字 String str = "PIC ...

  9. 如何利用CSS代码使图片和文字在同一行显示且对齐

    对于初学css的新手朋友来说,经常会遇到这样一个问题,当文字和图片出现在同一行或者同一个div里面的时候,在浏览器中运行出来的显示效果往往是在不同的行,那么,我们怎么才能利用CSS代码使图片和文字在同 ...

随机推荐

  1. Usbhub驱动编译

    在3g 4g的usb驱动基础上,加入以下部分,就可以驱动hub了 kmod-usb-hid 3.3.8-1 kmod-usbip 3.3.8-1 kmod-usbip-client 3.3.8-1 k ...

  2. flume 前世今生

    Cloudera 开发的分布式日志收集系统 Flume,是 hadoop 周边组件之一.其可以实时的将分布在不同节点.机器上的日志收集到不同的存储系统.Flume 初始的发行版本目前被统称为 Flum ...

  3. Jenkins触发远程Job的几种方式

    本文叙述基于以下假设前提,将介绍三种在不同的jenkins服务器之间触发Job的方法: 本地Jenkins Server local.jenkins.com远程Jenkins Server remot ...

  4. sp_who, sp_who2和sp_who3

    sp_who可以返回如下信息: (可选参数LoginName, 或active代表活动会话数)Spid         (系统进程ID)status      (进程状态)loginame  (用户登 ...

  5. vue之自定义组件

    除了核心功能默认内置的指令外,vue也允许用户注册自定义指令.虽然在vue2.0中,代码复用和抽象的主要形式是组件,但是有些情况下,我们仍需要对普通DOM元素进行底层操作,这个时候就需要用到自定义指令 ...

  6. Python——字符串2.0(实验)(python programming)

    直接打s,是程序员看到的:打print(),是用户看到的 列表 ] #列表索引,与数组唯一不同:等号左端可修改 转载自:https://www.cnblogs.com/wwwwwei/p/104816 ...

  7. seo优化之域名泛解析优缺点分析

    原文地址:http://www.phpddt.com/web/analysis-of-domain-name.html 自己也算半个SEOER,虽然没从事过优化工作,由于自己很感兴趣,每天还是会去看很 ...

  8. [UE4]Child Widget中的事件调度器

    在Child Widget中新建事件调度器,就会自动在使用该Child Widget的父级界面的事件列表中自动自动出现.功能十分强大.

  9. Redis登陆服务器和批量删除指定的key

    ps -ef |grep redis cd /opt/app/redis/bin ./redis-cli -h 192.168.0.67 -p 7001 -a 'hub2c!Redis'./redis ...

  10. http、TCP/IP协议与socket之间的区别(转载)

    http.TCP/IP协议与socket之间的区别  https://www.cnblogs.com/iOS-mt/p/4264675.html http.TCP/IP协议与socket之间的区别   ...