yaturner wrote:
> I have the following string defined in strings.xml
> 
> <string name="InfoLong"><b>%1$s\%</b><br/>Tie:%2$s\%<br/>Win%3$s\%</
> string>
> 
> and in my code:
> 
>               String FormatStr = getResources().getString(R.string.InfoLong);
>               String resultsText = String.format( FormatStr, ---, "--", "---" 
> );
>               CharSequence str = Html.fromHtml(resultsText);
>               percent.setText( str );
> 
> what I would like to get is:
> 
> ---%
> Tie:--% Win:---%
> 
> what I get is:
> 
> --%<br/>Tie:--%Win:---%
> 
> I have also tried \n and \\n instead of <br/> with similar results
> 
> My question is:
> 
> Can I embed a newline in a format string?

Yes, though I think your problem is more tied to the combination of the
newline and Html.fromHtml().

\n works. However, I think that will be converted into a space by
Html.fromHtml().

You might try <br> instead of the XHTML <br/> and see if that helps.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to