日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

android maxlength 汉字,Android TextView maxWidth、maxLines、maxLength、maxEms

發布時間:2024/1/1 Android 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android maxlength 汉字,Android TextView maxWidth、maxLines、maxLength、maxEms 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

TextView maxWidth、maxLines、maxLength、maxEms 的區別面紗就此揭開!掌握它們的區別對實際開發蠻有用處。若您有遇到其它相關問題,很是歡迎在評論中留言,我和其余讀者小伙伴們將幫助解決并持續更新至此文,達到幫助更多人的目的。若感本文對您有所幫助請點個贊吧!android

maxWidth

限制當前view的寬度,若此時高度設置為wrap_content,文字長度超過view的寬度時會自動換行web

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="TextView_maxWidth"

android:maxWidth="50dp"/>

maxLines

不管文字總體須要幾行才可顯示,最終只顯示 N 行。通常配合ellipsize標簽使用,它可指定在尾部添加省略號svg

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="TextView_maxWidthTextView_maxWidthTextView_maxWidth"

android:ellipsize="end"

android:maxLines="1"/>

maxLength

限制可顯示字符數量,超出部分會被截斷,設置 ellipsize 也無效,字母或漢字每一個單位均記作1,測試

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="TextView_maxWidth"

android:ellipsize="end"

android:maxLength="5"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="測試這個標簽的做用"

android:ellipsize="end"

android:maxLength="5"/>

maxEms

單行最多可現實的字符數量,超出限制自動換行,漢字記作2個單位,字母記作1個單位code

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="TextView_maxWidth"

android:maxEms="5"/>

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:background="#3E86A0"

android:textColor="#ffffff"

android:text="測試這個標簽的做用"

android:maxLines="1" // 這里設置了行數限制,因此下圖中的文字被截取

android:maxEms="5"/>

若您有遇到其它相關問題,很是歡迎在評論中留言,我和其余讀者小伙伴們將幫助解決并持續更新至此文,達到幫助更多人的目的。若感本文對您有所幫助請點個贊吧!xml

總結

以上是生活随笔為你收集整理的android maxlength 汉字,Android TextView maxWidth、maxLines、maxLength、maxEms的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。