Hi all,

Ever since I added conditional text formatting on my list items I've noticed
a performance drop. It's still usable but I'm somewhat obsessive about
performance/experience so I would really like to tweak my approach as best I
can. The following snippet is how I'm achieving my conditional formatting.
Is this the only way? (Perf drop appears to be related to making TextViews
spannable)

if( w.state.equalsIgnoreCase( Tasks.STATE_READ ))
{
  s.setSpan( new StyleSpan( Typeface.NORMAL ), 0, s.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE );
  i.setSpan( new StyleSpan( Typeface.NORMAL ), 0, i.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE );

  w.getInstructions().setTextColor( 0xFFBDBEBD );
  w.getDeadline().setTextColor( 0xFFBDBEBD );
}
else
{
  s.setSpan( new StyleSpan( Typeface.BOLD ), 0, s.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE );
  i.setSpan( new StyleSpan( Typeface.BOLD ), 0, i.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE );

  w.getInstructions().setTextColor( 0xFFBDBEBD );
  w.getDeadline().setTextColor( 0xFFFFFFFF );
 }

Thanks

-- 
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

Reply via email to