<?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. ulimit设置内存限制是否有效

    如何使用ulimit限制物理内存 限制物理内存 $ ulimit -m 512000 经测试,无效. 限制物理内存不起作用,ulimit不支持限制物理内存,可见man ulimit手册 -m The ...

  2. MySQL触发器详解

    MySQL触发器 触发器是特殊的存储过程.不同的是,触发器不需要手动调用.只要当预定义的事件发生时,会被MySQL自动调用.主要用于满足复杂业务的规则和需求. 一.创建触发器 1.创建只有一个执行语句 ...

  3. R3注入的四种方式

    DLL注入 1.首先要获取想要注入的进程句柄(OpenProcess) 2.从要注入的进程的地址空间中分配一段内存(VirtualAllocEx) 3.往分配的内存位置写入要注入的DLL名称(Writ ...

  4. Delphi实现软件中登录用户的操作权限

    数据库结构:包括两张表BaseData和UserRightData,BaseData中是一张基本表,里面不区分用户,UserRightData是用户权限表,结构和BaseData一样,只是多了用户字段 ...

  5. NPOI将DataGridView中的数据导出+导出Chart图表图片至Excel

    #region 导出Excel private HSSFWorkbook Workbook = null; private Sheet SheetOne = null; private DataFor ...

  6. 黄聪:PHP JSON_ENCODE 不转义中文汉字的方法

    ios程序中不识别读取到的JSON数据中 \u开头的数据. PHP 生成JSON的时候,必须将汉字不转义为 \u开头的UNICODE数据. 网上很多,但是其实都是错误的,正确的方法是在json_enc ...

  7. MDIEMDIE双心封装版0.3.0.0RC6V2

    MDIEMDIE双心封装版0.3.0.0 RC6V2官方主页:http://cres.s28.xrea.com/MDIE(多文档界面资源管理器)是一个MDI类型的文件管理软件,是代替资源管理器的一个无 ...

  8. django获取表单数据

    django获取单表数据的三种方式 v1 = models.Business.objects.all() # v1是QuerySet的列表 ,内部元素都是对象 v2 = models.Business ...

  9. ubuntu MySQL拒绝远程连接(10061)

    MySQL是使用apt-get安装的 1.停止mysql服务 sudo service mysql stop 2.修改配置文件/etc/mysql/mysql.conf.d/mysqld.cnf 将b ...

  10. flume-source

    1.1 Avro Source 监听Avro端口,从Avro client streams接收events.要求属性是粗体字.利用Avro Source可以实现多级流动.扇出流.扇入流等效果.另外也可 ...