需求:
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"
/>