http://stackoverflow.com/questions/4630440/how-to-change-a-textviews-style-at-runtime


<?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>
View.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view){
                //highlight the TextView
                myTextView.setTextAppearance(getApplicationContext(), R.style.boldText);
                myTextView.setBackgroundResource(R.color.highlightedTextViewColor);
            }
        });


+ Recent posts