On Apr 13, 2012, at 4:10 AM, DiCo wrote:
> Example that doesn't work in my case:
>
> TextView textView = (TextView) view.findViewById(R.id.textview);
>> SpannableString content = new SpannableString("Content");
>> content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
>> textView.setText(content);
> and
>
>
>> TextView textView = (TextView) view.findViewById(R.id.textview);
>> textView.setText(Html.fromHtml(getString(R.string.your_string_here)));
>
> In my case TextView.SetText Method doesn't have any ovveride version with
> ISpanned as parameter.
A variation on your approach: the TextView.TextFormatted [0] property takes an
ICharSequence, which ISpanned implements [1], so this should be valid:
using (SpannableString content = new SpannableString ("Content"))
using (UnderlineSpan underline = new UnderlineSpan ()) {
content.SetSpan(underline, 0, content.Length(), 0);
myTextView.TextFormatted = content;
}
- Jon
[0]
http://androidapi.xamarin.com/?link=P%3aAndroid.Widget.TextView.TextFormatted
[1] http://androidapi.xamarin.com/?link=T:Android.Text.ISpanned
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid