LoginSignup
0
0

More than 5 years have passed since last update.

在 Android 中限制 TextView 只能顯示一行並顯示三個點

Posted at

(筆記)

預設 TextView 有辦法跟著內容長高不會限制行數
在目標的 TextView 的 xml 加入這個屬性的設定就可以把內容限制在只顯示一行:

android:maxLines="1"

當限制行數時,預設的行為只會把內容切掉,不會顯示 ...
如果要加上後綴的 ... ,只要在 TextView 加上這個屬性的設定即可:

android:ellipsize="end" 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0