需求:
textview最多顯示四個字符,多餘四個就顯示 “…”
填坑:使用android:maxLength="4"是沒有效果的,
需要使用 android:maxEms="4"纔有效果,一定要加上android:singleLine=“true”
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxEms="4"
android:singleLine="true"
/>
需求:最多顯示兩行,多餘就顯示 “…”
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
/>