android Programming Glossary: startspan
Android Development: How To Replace Part of an EditText with a Spannable http://stackoverflow.com/questions/7338697/android-development-how-to-replace-part-of-an-edittext-with-a-spannable line TextView tv TextView findViewById R.id.textView1 int startSpan dispStr.indexOf first int endSpan dispStr.indexOf line Spannable.. android.R.style.TextAppearance_Large spanRange.setSpan tas startSpan endSpan Spannable.SPAN_EXCLUSIVE_EXCLUSIVE tv.setText spanRange..
How to use SpannableString with Regex in android? http://stackoverflow.com/questions/7364119/how-to-use-spannablestring-with-regex-in-android target int colour String vString String tv.getText int startSpan 0 endSpan 0 Spannable spanRange new SpannableString vString.. spanRange new SpannableString vString while true startSpan vString.indexOf target endSpan ForegroundColorSpan foreColour.. NEW span object every loop else it just moves the span if startSpan 0 break endSpan startSpan target.length spanRange.setSpan..
Android Development: How To Replace Part of an EditText with a Spannable http://stackoverflow.com/questions/7338697/android-development-how-to-replace-part-of-an-edittext-with-a-spannable String dispStr I'm the first line nI'm the second line TextView tv TextView findViewById R.id.textView1 int startSpan dispStr.indexOf first int endSpan dispStr.indexOf line Spannable spanRange new SpannableString dispStr TextAppearanceSpan.. dispStr TextAppearanceSpan tas new TextAppearanceSpan this android.R.style.TextAppearance_Large spanRange.setSpan tas startSpan endSpan Spannable.SPAN_EXCLUSIVE_EXCLUSIVE tv.setText spanRange You can adapt it to your needs share improve this answer..
How to use SpannableString with Regex in android? http://stackoverflow.com/questions/7364119/how-to-use-spannablestring-with-regex-in-android ABC Color.RED private void changeTextinView TextView tv String target int colour String vString String tv.getText int startSpan 0 endSpan 0 Spannable spanRange new SpannableString vString while true startSpan vString.indexOf target endSpan ForegroundColorSpan.. String vString String tv.getText int startSpan 0 endSpan 0 Spannable spanRange new SpannableString vString while true startSpan vString.indexOf target endSpan ForegroundColorSpan foreColour new ForegroundColorSpan colour Need a NEW span object every.. foreColour new ForegroundColorSpan colour Need a NEW span object every loop else it just moves the span if startSpan 0 break endSpan startSpan target.length spanRange.setSpan foreColour startSpan endSpan Spannable.SPAN_EXCLUSIVE_EXCLUSIVE..
|