0

Good day all,

I have an issue that's truly maddening.
For some reason the textColor attribute for the EditText component in my custom theme is not taking effect.

Please note that everything else for my custom theme is working, it's just the 'textColor' part that is giving trouble.

I've seen other people with the same issue, and their 'solutions' aren't working for me.

[Articles referenced before posting this]
TextView color is always white for AppCompatActivity
Edittext color is white in appcompat 22.2

[My Code and Setup]

Android Studio Version 2.1.1

CustomTheme XML Snippet

<style name="CustomTheme" parent="@style/AppTheme">
  <item name="editTextStyle">@style/CustomEditText</item> <!-- I'm extending AppCompatActivity, hence no 'android:' prefix! -->
</style>

<style name="CustomEditText" parent="@android:style/Widget.EditText">
    <item name="android:background">@drawable/custom_edit_text</item>
    <item name="android:textColor">#333333</item>
    <item name="android:paddingLeft">12dp</item>
    <item name="android:paddingRight">12dp</item>
    <item name="android:paddingTop">8dp</item>
    <item name="android:paddingBottom">8dp</item>
</style>

Android Manifest XML Snippet

<application android:theme="@style/CustomTheme">...</application>

build.gradle (app) Snippet

android {
  compileSdkVersion 23
  buildToolsVersion "23.0.3"

  defaultConfig {
    minSdkVersion 18
    targetSdkVersion 23
  }
}

dependencies {
  compile 'com.android.support:appcompat-v7:23.1.1' <!-- I've even tried this version v7:23.4.0 -->
}

Thanks in advance for your help.

Community
  • 1
  • 1
add
  • 111
  • 3
  • 16
  • can you please share the layout containing the EditText – younes zeboudj Jul 30 '16 at 21:35
  • @youzking Thank you for suggesting that I post the layout. When I was copying the layout code to update my question, I recognized that the 'textColor' was being set to white in the layout xml itself, and that caused the issue. Thanks a mil, what a silly mistake. – add Jul 30 '16 at 21:54
  • you are most welcome, glad it helped you. – younes zeboudj Jul 30 '16 at 22:06

1 Answers1

0

Based on a comment by youzking asking for a copy of the activity layout. I saw that I was setting the 'textColor' to white in the layout xml for the Activity. Hence, that was the issue as it was overriding the theme 'textColor'.

Community
  • 1
  • 1
add
  • 111
  • 3
  • 16