Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. Spannable str = new SpannableStringBuilder("How can I achieve such an effect with an Android TextView. It looks somehow like selected text and I couldn't find something similar in the API.");
  2. str.setSpan(new NewSpannableClass(), 0, str.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  3. ((TextView)findViewById(R.id.text)).setText(str);
  4.  
  5. <TextView
  6. android:background="#0000FF"
  7. android:textColor="#FFFFFF" />
  8.  
  9. <TextView
  10. android:layout_width="wrap_content"
  11. android:layout_height="wrap_content"
  12. android:background="#0000FF"
  13. android:textColor="#FFFFFF" />
  14.  
  15. <TextView android:background="#0000FF">
  16.  
  17. android:background="#0088FF"
  18.  
  19. <TextView
  20. android:layout_width="wrap_content"
  21. android:layout_height="wrap_content"
  22. android:background="#0088FF"
  23. android:text="@string/your-text"
  24. android:textColor="#FFFFFF"
  25. android:textSize="18sp"
  26. android:textStyle="bold" />
  27.  
  28. <TextView
  29. android:id="@+id/comment_dis"
  30. android:layout_width="wrap_content"
  31. android:layout_height="wrap_content"
  32. android:gravity="center"
  33. android:text="Stack Overflow
  34. android:textColor="#ffffff"
  35. android:background="#3cabdc"/>
  36.  
  37. <LinearLayout
  38. android:layout_width="wrap_content"
  39. android:layout_height="wrap_content"
  40. android:background="#000000" >
  41.  
  42. <TextView
  43. android:layout_width="match_parent"
  44. android:layout_height="match_parent"
  45. android:textColor="#FFFFFF"
  46. android:text="@string/text" />
  47.  
  48. </LinearLayout>
  49.  
  50. <TextView
  51. android:id="@+id/TextView"
  52. android:layout_width="wrap_content"
  53. android:layout_height="wrap_content"
  54. android:gravity="center"
  55. android:textColor="#ffffff"
  56. android:background="#1bgtbgt"/>
  57.  
  58. text.setBackgroundColor( int color);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement