Say I have a TextView with some dynamic text. This TextView is being placed inside a LinearLayout with WRAP_CONTENT LayoutParams for both width & height.
Problem is that some of the text is - breaking onto second(or third) line - wrapping. I want to avoid this.
I have tried to replace all ' '(space chars) with non-breaking space character. This hasn't helped. The text still breaks. I also cannot set the TextView's maxLines=1 because there are some newline chars in the String-data.
I am not sure if any code samples need to be included. If there;s something specific, please do ask me in a comment.
Any help will be greatly appreciated :~)
@Joe B. Answer is right. but android:singleLine="true" is deprecated. You need to use
android:maxLines="1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With