直播平台搭建源码,TextView限制文字长度且超过显示省略号

直播平台搭建源码,TextView限制文字长度且超过显示省略号

一、ellipsize

 

1
 <!-- Where to ellipsize text. 在哪里省略文本 --><br>    <attr name="ellipsize"><br>        <enum name="none" value="0" /><br>        <enum name="start" value="1" /><br>        <enum name="middle" value="2" /><br>        <enum name="end" value="3" /><br>        <enum name="marquee" value="4" /><br>    </attr>

二、maxEms

 

1
 <!-- 使 TextView 最多有这么多 em 宽 --><br> <!-- Makes the TextView be at most this many ems wide. --><br>        <attr name="maxEms" format="integer" min="0" />

 

三、singleLine

 

1
<!-- Constrains the text to a single horizontally scrolling line<br>     instead of letting it wrap onto multiple lines, and advances<br>     focus instead of inserting a newline when you press the<br>     enter key.<br>     The default value is false (multi-line wrapped text mode) for non-editable text, but if<br>     you specify any value for inputType, the default is true (single-line input field mode).<br>     {@deprecated This attribute is deprecated. Use <code>maxLines</code> instead to change<br>     the layout of a static text, and use the <code>textMultiLine</code> flag in the<br>     inputType attribute instead for editable text views (if both singleLine and inputType<br>     are supplied, the inputType flags will override the value of singleLine). } --><br>     <attr name="singleLine" format="boolean" />

 

四、maxLength

 

1
<!-- 设置输入过滤器以将文本长度限制为指定数字 --><br><!-- Set an input filter to constrain the text length to the specified number. --><br>        <attr name="maxLength" format="integer" min="0" />

 

五、使用

 

1
 <androidx.appcompat.widget.AppCompatTextView<br>        android:layout_width="wrap_content"<br>        android:layout_height="wrap_content"<br>        android:ellipsize="end" <br>        android:maxLength="10"<br>        android:maxEms="10"<br>        android:singleLine="true"<br>        android:text />

 

以上就是直播平台搭建源码,TextView限制文字长度且超过显示省略号, 更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(42)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2021-08-26 直播带货平台源码自定义view之利用PathEffect实现动态效果实现
2021-08-26 短视频商城源码详情页嵌套滑动效果实现
2021-08-26 Android1对1直播源码实现颜色渐变动画效果
点击右上角即可分享
微信分享提示