Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. textview.setTextAppearance();
  2.  
  3. <?xml version="1.0" encoding="utf-8"?>
  4. <resources>
  5.  
  6. <style name="boldText">
  7. <item name="android:textStyle">bold|italic</item>
  8. <item name="android:textColor">#FFFFFF</item>
  9. </style>
  10.  
  11. <style name="normalText">
  12. <item name="android:textStyle">normal</item>
  13. <item name="android:textColor">#C0C0C0</item>
  14. </style>
  15.  
  16. </resources>
  17.  
  18. <color name="highlightedTextViewColor">#000088</color>
  19. <color name="normalTextViewColor">#000044</color>
  20.  
  21. myTextView.setOnClickListener(new View.OnClickListener() {
  22. public void onClick(View view){
  23. //highlight the TextView
  24. myTextView.setTextAppearance(getApplicationContext(), R.style.boldText);
  25. myTextView.setBackgroundResource(R.color.highlightedTextViewColor);
  26. }
  27. });
  28.  
  29. myTextView.setTextAppearance(getApplicationContext(), R.style.normalText);
  30. myTextView.setBackgroundResource(R.color.normalTextViewColor);
  31.  
  32. textView.setTypeface(null, Typeface.BOLD); // Typeface.NORMAL, Typeface.ITALIC etc.
  33.  
  34. TextView tvCompany = (TextView)findViewById(R.layout.tvCompany);
  35. tvCompany.setTypeface(null,Typeface.BOLD);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement