HarmonyOS Text超出部分末尾显示...
生活随笔
收集整理的這篇文章主要介紹了
HarmonyOS Text超出部分末尾显示...
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
HarmonyOS Text 默認(rèn)是顯示一行,想要Text超出部分末尾顯示...
設(shè)置 truncation_mode="ellipsis_at_end" 即可,
truncation_mode 還有其他的屬性, 當(dāng)truncation_mode="ellipsis_at_start" 設(shè)置為true是點(diǎn)點(diǎn)在文字開(kāi)頭顯示,當(dāng) truncation_mode="ellipsis_at_middle" 在中間的時(shí)候點(diǎn)點(diǎn)在中間顯示.
xml 代碼如下
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayoutxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:orientation="vertical"><Textohos:id="$+id:text"ohos:height="match_content"ohos:width="200vp"ohos:text="窗前明月光,疑是地上霜."ohos:text_size="22fp"ohos:truncation_mode="ellipsis_at_end"ohos:top_margin="50vp"/><Textohos:id="$+id:text1"ohos:height="match_content"ohos:width="200vp"ohos:text="窗前明月光,疑是地上霜."ohos:text_size="22fp"ohos:truncation_mode="ellipsis_at_start"ohos:top_margin="50vp"/><Textohos:id="$+id:text2"ohos:height="match_content"ohos:width="200vp"ohos:text="窗前明月光,疑是地上霜."ohos:text_size="22fp"ohos:truncation_mode="ellipsis_at_middle"ohos:top_margin="50vp"/></DirectionalLayout>
效果圖:
?
總結(jié)
以上是生活随笔為你收集整理的HarmonyOS Text超出部分末尾显示...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 土鸡多少钱啊?
- 下一篇: HarmonyOS 设置图标在Text