Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- textview.setTextAppearance();
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <style name="boldText">
- <item name="android:textStyle">bold|italic</item>
- <item name="android:textColor">#FFFFFF</item>
- </style>
- <style name="normalText">
- <item name="android:textStyle">normal</item>
- <item name="android:textColor">#C0C0C0</item>
- </style>
- </resources>
- <color name="highlightedTextViewColor">#000088</color>
- <color name="normalTextViewColor">#000044</color>
- myTextView.setOnClickListener(new View.OnClickListener() {
- public void onClick(View view){
- //highlight the TextView
- myTextView.setTextAppearance(getApplicationContext(), R.style.boldText);
- myTextView.setBackgroundResource(R.color.highlightedTextViewColor);
- }
- });
- myTextView.setTextAppearance(getApplicationContext(), R.style.normalText);
- myTextView.setBackgroundResource(R.color.normalTextViewColor);
- textView.setTypeface(null, Typeface.BOLD); // Typeface.NORMAL, Typeface.ITALIC etc.
- TextView tvCompany = (TextView)findViewById(R.layout.tvCompany);
- tvCompany.setTypeface(null,Typeface.BOLD);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement