I have an Appwidget displaying days until an event like:
eventname (-231 days)
If possible I want to display this String in one line. If the eventname is too long I want to display the full term in braces into a new line. So that it is like:
longeventname
(-231 days)
instead of:
longeventname (-231
days)
(or anything similar)
Is there a way to archive this? Can I make (-231 days) "atomic"?
string.getLength won't work since the size of the widget will vary by device.
Add Line Breaks to a TextView Just add a \n to your text. This can be done directly in your layout file, or in a string resource and will cleanly break the text in your TextView to the next line.
Add \t for tab and \n for new line.
for the new line in TextView just add \n in middle of your text it works..
If you want to show a strike-through text you can do it programming using PaintFlags. You can set paint flags Paint. STRIKE_THRU_TEXT_FLAG to a TextView and it will add a strike-through to the text. TextView textView = (TextView) findViewById(R.
You could use a non-breaking space between the number and "days".
That's  
for a string in XML, or \u00A0
for a string in Java code.
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