HarmonyOS Text超出部分末尾显示...
生活随笔
收集整理的這篇文章主要介紹了
HarmonyOS Text超出部分末尾显示...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
HarmonyOS Text 默認是顯示一行,想要Text超出部分末尾顯示...
設置 truncation_mode="ellipsis_at_end" 即可,
truncation_mode 還有其他的屬性, 當truncation_mode="ellipsis_at_start" 設置為true是點點在文字開頭顯示,當 truncation_mode="ellipsis_at_middle" 在中間的時候點點在中間顯示.
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>
效果圖:
?
總結
以上是生活随笔為你收集整理的HarmonyOS Text超出部分末尾显示...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 土鸡多少钱啊?
- 下一篇: VANS的鞋子40.5码数相当于NIKE