Android EditText mixed with background

My app uses Theme.Holo.Light.DarkActionBar as the parent theme.

When I use my Android 3.2 tablet emulator, the EditText form is almost impossible to see. He seems to be trying to draw white on white. Seen here:

enter image description here

When I use it on my Android 4.0 tablet emulator, the EditText form looks just fine. You can see a dark gray line along the bottom of the EditText. If you look at the image above, you can hardly see the white line in the same place where it intersects the light gray background watermark.

enter image description here

Here is my EditText in the layout:

 <EditText android:id="@+id/fieldName" style="@style/PlayerDetails.Field" android:capitalize="words" /> 

And here is the style:

 <style name="PlayerDetails.Field"> <item name="android:layout_weight">0.65</item> <item name="android:paddingLeft">10dp</item> <item name="android:layout_width">0dp</item> <item name="android:layout_height">fill_parent</item> <item name="android:layout_marginLeft">10dp</item> </style> 

Why is my EditText getting the wrong color? I do not override the drawing or background code.

+8
android android-edittext android-3.0-honeycomb
source share
3 answers

The other answers were not really the solution to my problem, and I never figured out what REALLY caused the problem. However, this is how I decided: My workaround was to copy the .9.png and style for the EditText widget from Ice Cream Sandwich and was hardcoded into my cell and ice cream sandwich application.

EDIT:

I created a file called res / drawable-nodpi / edit_text_holo_light.xml with the following:

 <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_multiline="true" android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/textfield_multiline_default_holo_light" /> <item android:state_multiline="true" android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_multiline_disabled_holo_light" /> <item android:state_multiline="true" android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_multiline_activated_holo_light" /> <item android:state_multiline="true" android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/textfield_multiline_focused_holo_light" /> <item android:state_multiline="true" android:state_enabled="true" android:drawable="@drawable/textfield_multiline_default_holo_light" /> <item android:state_multiline="true" android:state_focused="true" android:drawable="@drawable/textfield_multiline_disabled_focused_holo_light" /> <item android:state_multiline="true" android:drawable="@drawable/textfield_multiline_disabled_holo_light" /> <item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" /> <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/textfield_disabled_holo_light" /> <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/textfield_activated_holo_light" /> <iten android:state_enabled="true" android:state_activated="true" android:drawable="@drawable/textfield_focused_holo_light" /> <item android:state_enabled="true" android:drawable="@drawable/textfield_default_holo_light" /> <item android:state_focused="true" android:drawable="@drawable/textfield_disabled_focused_holo_light" /> <item android:drawable="@drawable/textfield_disabled_holo_light" /> </selector> 

Then I created a style in my styles.xml for installation:

 <item name="android:background">@drawable/edit_text_holo_light</item> 

Then I copied the .9.png files from sdk android and put them in res / drawable- *. The file names are listed in the above xml.

+5
source share

You may have an action bar and still see a EditText light gray watermark if you use themes like the one below:

AndroidManifest.xml

 <activity android:name=".ClassName" android:label="ClassName" android:theme="@style/MyTheme" > 

styles.xml

 <resources> <style name="MyTheme" parent="android:Theme.Holo.Light"> <item name="android:actionBarStyle">@style/MyActionBar</item> </style> <style name="MyActionBar" parent="android:Widget.Holo.ActionBar"> <item name="android:background">@color/black</item> </style> </resources> 

This works for the theme "android: Theme.Holo.Light", but not for the theme "android: Theme.Holo".

+1
source share

I figure out my problem. By setting the theme in the android:theme="@android:style/Theme" application element in the manifest.xml file.

 <application android:label="@string/app_name" android:icon="@drawable/logo" android:vmSafeMode="false" android:theme="@android:style/Theme"> 

Try it.

0
source share

All Articles