I’m having difficulty getting Android Styles to work.
As a test, I created an EditText control and associated it with a Style called “CodeFont” like such:
EditText et = new EditText(this, null, Resource.Style.CodeFont);
Next, I defined a style which inherits from a standard style and changes the text color to red like such:
<resources>
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#FF0000</item>
<item name="android:typeface">monospace</item>
</style>
</resources>
What am I doing wrong? When the EditText appears, it no longer features the orange border on focus. This makes me think that the styling is working. However, the text color remains black.
Ok. I finally found the solution. I had to piece it together from a few resources.
EditText et1 = new EditText(this, null, Resource.Attribute.CodeFontRef);