Difference between setTextAppearance from code vs. resource
<p>When I call <code>setTextAppearance(this, android.R.style.TextAppearance_Medium)</code> programmatically I get medium sized font with light grey text.</p>

<p>However, when I use <code>android:textAppearance="@android:style/TextAppearance.Medium"</code> in the xml then I get the same sized text but it is colored black.</p>

<p>What is the difference between these?</p>

<p>The relevant part of the xml file looks as following:</p>

<pre><code>&lt;Button
    android:id="@+id/button1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="@android:style/TextAppearance.Medium"
    android:text="Button" /&gt;
</code></pre>

<p>The code looks like this:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Button button = (Button)findViewById(R.id.button1);
    button.setText("This is a long text");
    //button.setTextAppearance(this, android.R.style.TextAppearance_Medium);
}
</code></pre>
