项目中使用lint扫描发现提示singleLine提示使用maxLines=″1″来替代,但是替换过后发现了一个问题,在拥有长单词或者回车的情况下会导致一行展示不完整。
后来查阅了资料发现:
android:maxLines Makes the TextView be at most this many lines tall.
android:singleLine Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key.
在使用中如果有文字需要强制一行展示的时候还是需要用到 singleLine。