Prevent TextView from wrapping in parent

前端 未结 5 1996
耶瑟儿~
耶瑟儿~ 2020-12-13 18:19

How do I prevent a TextView, or any visual object, from wrapping to the screen and instead have them chopped off the sides? Is there some XML attribute or code to do this or

5条回答
  •  盖世英雄少女心
    2020-12-13 18:43

    check out android:maxLines="1" and if you want to add ending ... add also android:ellipsize="end"

    
    

    android:singleLine="true" was deprecated in API Level 3.

提交回复
热议问题