In my application, I want to set top and bottom margin of 8 dip to a textview. So if I do it like -
<TextView
android:id="@+id/tv_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/settings_plain_text"/>
it works fine where the style contents are -
<style name="settings_plain_text">
<item name="android:layout_marginTop"> 8dip </item>
<item name="android:layout_marginBottom"> 8dip </item>
<item name="android:textSize"> 18sp </item>
</style>
But when I apply the same style to that textview programmatically like -
textview.setTextAppearance(context, R.style.settings_plain_text);
it does not show the top and bottom margin that I've set in style. Please help.