In my application, I want to set a style in a TextView that will make the TextView look like a title, as shown in the following figure -

When I apply the style from styles.xml (given below), it applies the font and font color as indicated. But on a white background, it does not apply. Can we even do this?
A specific style is as follows:
<?xml version="1.0" encoding="utf-8"?>
<style name="settings_header"> <item name="android:layout_marginBottom"> 10dip </item> <item name="android:background"> @color/white </item> <item name="android:paddingLeft"> 10dip </item> <item name="android:layout_width"> match_parent </item> <item name="android:layout_height"> wrap_content </item> <item name="android:textSize"> 22sp </item> <item name="android:textColor"> @color/black </item> <item name="android:textStyle"> bold </item> </style>
The code that applies the style is similar to
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textview = (TextView) findViewById(R.id.textView); textview.setTextAppearance(ScrSettings.this,R.style.settings_header); }
source share