The most common requirement in Android is to briefly display the content when displaying information externally. TextView only needs to set the following properties in the static layout file:
android:maxWidth=“100dp” // 宽度是多少才算超出
android:maxLines="2" // 高度多少才算超出
android:ellipsize="end" // 代表启用省略号
Issues that are easily overlooked:
In layout, most people like to set wrap_content and match_parent to the width and height of TextView. The two parameters match_parent and wrap_content are not clear values, resulting in the ellipsis not being displayed (because the system does not know where the boundary is)