[android-developers] Re: Highlight part of the text in a textview object

2010-04-20 Thread patbenatar
You could TRY span bgcolor=redyour red highlighted text/span




On Apr 19, 12:43 pm, sebastian23 sebastia...@gmail.com wrote:
 the problem is that your solution is only for the font color, but i want to
 set the font background :(

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: Highlight part of the text in a textview object

2010-04-19 Thread social hub
You can try the html way to styling

This used to work for me.

string =font color='#ff'  bhello/b /font

textview.setText(Html.fromHtml(string))


On Sun, Apr 18, 2010 at 1:17 AM, patbenatar patbena...@gmail.com wrote:

 Sorry, bolding and italicizing is the extent of my text formatting
 knowledge with Android.

 Anyone else know more about this?






 On Apr 17, 5:33 am, Sebastian Müller sebastia...@gmail.com wrote:
  Thanks a lot for your answer. This works great for the Bold thing, but
  background isnt changing...do you know why??
 
  my Code:
 
  if (index = 0) {
Spannable str = (Spannable) chapterResult.getText();
 str.setSpan(new BackgroundColorSpan(0xFF), index, index +
  searchQuery.getAll().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD),
 index,
  index + searchQuery.getAll().length(),
 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 
  }
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group athttp://
 groups.google.com/group/android-developers?hl=en

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


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

[android-developers] Re: Highlight part of the text in a textview object

2010-04-18 Thread patbenatar
Sorry, bolding and italicizing is the extent of my text formatting
knowledge with Android.

Anyone else know more about this?






On Apr 17, 5:33 am, Sebastian Müller sebastia...@gmail.com wrote:
 Thanks a lot for your answer. This works great for the Bold thing, but
 background isnt changing...do you know why??

 my Code:

 if (index = 0) {
           Spannable str = (Spannable) chapterResult.getText();
            str.setSpan(new BackgroundColorSpan(0xFF), index, index +
 searchQuery.getAll().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), index,
 index + searchQuery.getAll().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

 }

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Highlight part of the text in a textview object

2010-04-17 Thread patbenatar
Here is the more difficult, lower-level way to do this (probably also
has more functionality): 
http://developer.android.com/reference/android/text/Spannable.html

Here is the much easier way to do this: 
http://developer.android.com/reference/android/text/Html.html
... This one is REALLY nice. You can do things like
Html.fromHtml(Whatever I want bbold/b); .. This allows you to
use basic HTML markup to format your text. I'm not sure how many or
which HTML tags are supported.

-Nick




On Apr 16, 9:04 am, sebastian23 sebastia...@gmail.com wrote:
 Hi toghether

 i habe some text displayed in a textview and would like to highlight (e.g. a
 specific background or font color) part of it. But how can i do that? didn't
 found a solution in the api or google.

 thanks for any hint

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

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