当前位置: 首页 > news >正文

Android 处理多个TextView, 文案过长时前面文本省略的问题

遇到显示多个TextView,文案过短时,这几个TextView跟随显示,文案过程时,前面TextView省略,后个的TextView全显示。效果如下:

用ConstraintLayout 没有得到解决,采用 RelativeLayout 解决

代码如下:

   <RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="left"><TextViewandroid:id="@+id/tv1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="@dimen/base_px_1"android:layout_toStartOf="@+id/tv2"android:textColor="@color/base_color_656565"android:textSize="@dimen/base_sp_11"tools:text=" 约27km," /><TextViewandroid:id="@+id/tv2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="@dimen/base_px_1"android:layout_toStartOf="@+id/tv3"android:textColor="@color/base_color_656565"android:textSize="@dimen/base_sp_11"tools:text="公共交通约" /><TextViewandroid:id="@+id/tv3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentEnd="true"android:textColor="@color/base_color_242424"android:textSize="@dimen/base_sp_12"tools:text="1小时1分钟" /><TextViewandroid:id="@+id/tv"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="@dimen/base_px_1"android:layout_toStartOf="@+id/tv1"android:ellipsize="end"android:maxLines="1"android:textColor="@color/base_color_656565"android:textSize="@dimen/base_sp_11"tools:text="去往武汉长江大桥" /></RelativeLayout>

相关文章:

  • 4.8 内部类
  • Vue之样式绑定
  • pg数据库插入数据的时候,进行数据去重
  • Capacitor 打包 h5 到 Android 应用,uniapp https http net::ERR_CLEARTEXT_NOT_PERMITTED
  • 09、SpringCloud -- 利用redis的原子性控制高并发请求访问到service层、本地标识
  • 2023年【R1快开门式压力容器操作】考试题及R1快开门式压力容器操作模拟考试
  • 万维普惠:一支开启金融数智化时代的团队
  • 自主查询成绩
  • 13、SpringCloud -- RocketMQ 消息发送和消费的实际应用
  • ElasticSearch深度解析入门篇:高效搜索解决方案的介绍与实战案例讲解,带你避坑
  • 小程序使用web-view增加新样式
  • Vdue之模版语法指令过滤器计算属性监听属性
  • ruoyi框架前端vue部署生产环境教程
  • 给出n个字母(a-z),找出出现次数最多的字母并输出。(附ASCII码表)
  • 基于枚举实现的工厂模式
  • 《用数据讲故事》作者Cole N. Knaflic:消除一切无效的图表
  • 【402天】跃迁之路——程序员高效学习方法论探索系列(实验阶段159-2018.03.14)...
  • ES10 特性的完整指南
  • Go 语言编译器的 //go: 详解
  • js作用域和this的理解
  • Laravel 实践之路: 数据库迁移与数据填充
  • PHP变量
  • Storybook 5.0正式发布:有史以来变化最大的版本\n
  • uni-app项目数字滚动
  • vue 配置sass、scss全局变量
  • 安卓应用性能调试和优化经验分享
  • 讲清楚之javascript作用域
  • 前言-如何学习区块链
  • 山寨一个 Promise
  • 深入 Nginx 之配置篇
  • 学习HTTP相关知识笔记
  • 用mpvue开发微信小程序
  • 怎么将电脑中的声音录制成WAV格式
  • C# - 为值类型重定义相等性
  • 交换综合实验一
  • ​html.parser --- 简单的 HTML 和 XHTML 解析器​
  • ​批处理文件中的errorlevel用法
  • # MySQL server 层和存储引擎层是怎么交互数据的?
  • (Redis使用系列) Springboot 实现Redis 同数据源动态切换db 八
  • (附源码)springboot 基于HTML5的个人网页的网站设计与实现 毕业设计 031623
  • (使用vite搭建vue3项目(vite + vue3 + vue router + pinia + element plus))
  • (五)c52学习之旅-静态数码管
  • (转)3D模板阴影原理
  • (自适应手机端)响应式新闻博客知识类pbootcms网站模板 自媒体运营博客网站源码下载
  • ./和../以及/和~之间的区别
  • .Net Core与存储过程(一)
  • .Net 代码性能 - (1)
  • .NET 简介:跨平台、开源、高性能的开发平台
  • .NET/C# 避免调试器不小心提前计算本应延迟计算的值
  • .Net接口调试与案例
  • .NET框架设计—常被忽视的C#设计技巧
  • [.NET 即时通信SignalR] 认识SignalR (一)
  • [BUUCTF]-PWN:wustctf2020_number_game解析(补码,整数漏洞)
  • [bzoj 3124][sdoi 2013 省选] 直径
  • [C++] sqlite3_get_table 的使用