Ian Vink
Ian Vink

Reputation: 68810

Android white text in search box

See attached

I am using a searchbar with the theme below (I know very little about Android themes, yet)

How do I make the text typed, in this case, "Hi Mom" white?

<style name="_Credential" parent="android:Theme.Holo.Light.DarkActionBar">
  <item name="android:editTextBackground">@drawable/credential_edit_text_holo_light</item>
  <item name="android:textColorHighlight">#99005984</item>
  <item name="android:textSelectHandleLeft">@drawable/credential_text_select_handle_left</item>
  <item name="android:textSelectHandleRight">@drawable/credential_text_select_handle_right</item>
  <item name="android:textSelectHandle">@drawable/credential_text_select_handle_middle</item>
  <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewCredential</item>
  <item name="android:listChoiceIndicatorMultiple">@drawable/credential_btn_check_holo_light</item>
  <item name="android:listChoiceIndicatorSingle">@drawable/credential_btn_radio_holo_light</item>
  <item name="android:buttonStyle">@style/ButtonCredential</item>
  <item name="android:imageButtonStyle">@style/ImageButtonCredential</item>
  <item name="android:dropDownSpinnerStyle">@style/SpinnerCredential</item>
  <item name="android:progressBarStyleHorizontal">@style/ProgressBarCredential</item>
  <item name="android:seekBarStyle">@style/SeekBarCredential</item>
  <item name="android:ratingBarStyle">@style/RatingBarCredential</item>
  <item name="android:ratingBarStyleIndicator">@style/RatingBarBigCredential</item>
  <item name="android:ratingBarStyleSmall">@style/RatingBarSmallCredential</item>
  <item name="android:buttonStyleToggle">@style/ToggleCredential</item>
  <item name="android:listChoiceBackgroundIndicator">@drawable/credential_list_selector_holo_light</item>
  <item name="android:activatedBackgroundIndicator">@drawable/credential_activated_background_holo_light</item>
  <item name="android:fastScrollThumbDrawable">@drawable/credential_fastscroll_thumb_holo</item>
</style>

enter image description here

Upvotes: 1

Views: 283

Answers (2)

Human
Human

Reputation: 10815

<style name="_Credential" parent="android:Theme.Holo.Light.DarkActionBar">
      ...
      <item name="android:editTextColor">#ffffff</item> <!--Allow to change the editText color-->
      ...
</style>

Upvotes: 2

Alex K
Alex K

Reputation: 8338

So you can't actually change the TextColor of something like a search box with android:textColor. Instead, you need to use the whole family of the textColor... attributes.

Create a custom style that has your main style as it's parent, and then change all three kinds of colors to be what you want. So, something like this:

<style name="master" paret="@android:Theme.Holo.Light.DarkActionBar">
    <item name="android:textColorPrimary">#FFFFFF</item>
    <item name="android:textColorSecondary">#FFFFFF</item>
    <item name="android:textColorTertiary">#FFFFFF</item>
</style>

Read more about this here.

Upvotes: 1

Related Questions