Set margin in style and apply that style to TextView programmatically
<p>In my application, I want to set top and bottom margin of 8 dip to a textview. So if I do it like -</p>

<pre><code>&lt;TextView
android:id="@+id/tv_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/settings_plain_text"/&gt;
</code></pre>

<p>it works fine where the style contents are -</p>

<pre><code>&lt;style name="settings_plain_text"&gt;
    &lt;item name="android:layout_marginTop"&gt; 8dip &lt;/item&gt;
    &lt;item name="android:layout_marginBottom"&gt; 8dip &lt;/item&gt;
    &lt;item name="android:textSize"&gt; 18sp &lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p>But when I apply the same style to that textview programmatically like -</p>

<pre><code>textview.setTextAppearance(context, R.style.settings_plain_text);
</code></pre>

<p>it does not show the top and bottom margin that I've set in style.
Please help.</p>
