<?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. angularjs 外部调用controller中的方法

    angular.element(document.querySelector('[ng-controller=mainCtrl]')).scope().viewGo('tab.VIPPay_Succe ...

  2. 【转】jumpserver 堡垒机环境搭建(图文详解)

    jumpserver 堡垒机环境搭建(图文详解)   摘要: Jumpserver 是一款由python编写开源的跳板机(堡垒机)系统,实现了跳板机应有的功能.基于ssh协议来管理,客户端无需安装ag ...

  3. DLL对象类型转换

    //以下代码是错误的!!! //这一节主要告诉大家,以这种方式进行开发dll是不对的以及错误原因,正确的方式是什么! //DLL内创建对象,并把对象返回 function GetDataSet(str ...

  4. Requests+正则表达式爬取猫眼电影

    目标 提取出猫眼电影TOP100的电影名称.时间.评分.图片等信息,提取站点的URL为http://maoyan.com/board/4,提取的结果以文本的形式保存下来. 准备工作 请安装好reque ...

  5. influxDB1.6版安装与配置(windows环境)、Jmeter+influxDB+Grafana性能监控

    influxDB1.6版安装与配置(windows环境).Jmeter+influxDB+Grafana性能监控 来源:https://blog.csdn.net/SwTesting/article/ ...

  6. oracle常用小知识点

    alter table us_studies modify enroldate  default to_char(sysdate,'yyyy-mm-dd'); ALTER TABLE QS_QUEUE ...

  7. html json 导出Excel

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. sudo 命令报错的解决方法

    尝试着用终端打开Mac的安全权限(sudo spctl --master-disable),却显示以下提示,望高手解答. sudo: /etc/sudoers is world writablesud ...

  9. spring4.0之三:@RestController

    spring4.0重要的一个新的改进是@RestController注解,它继承自@Controller注解.4.0之前的版本,Spring MVC的组件都使用@Controller来标识当前类是一个 ...

  10. 学习笔记之HTML 教程 | 菜鸟教程

    HTML 教程 | 菜鸟教程 http://www.runoob.com/html/html-tutorial.html 菜鸟教程在线编辑器 http://www.runoob.com/try/try ...