Reputation: 2119
I have a String like this:
"speed1: 10 km/h, speed2: 20 km/h, speed3: 30 km/h, speed4: 40 km/h, speed5: 50 km/h"
I want to display this string in a TextView, which can have a variable width. On some devices, the hole String fits in one line. On other devices, 2-3 lines are needed.
I want the String to be broken only at the comma- characters, so that parameters and values are on the same line.
Is there a special character in Android for that? (Or do I have to first let the String be drawn, count the number of lines, and then replace some commas by a newline character).
Upvotes: 1
Views: 483
Reputation: 239
Maybe ugliest solution in world, but how about replacing the "normal" spaces except the ones after comma, with Unicode non-breaking space? ("\u00A0")?
Upvotes: 2