2

I have a EditText in a layout with a white background. On Android 2.x, the EditText is visible with a frame around it, but in Ice Cream Sandwich on a Galaxy Nexus, it is not visible until I click on it. Then the blue line under it appears.

I think this is due to the holo theme in Ice Cream Sandwich, but can I somehow get the line to show all the time? Or do I have to add a custom background 9patch-image?

I am using ActionBarSherlock for compatibility, but I don't think this is an issue here, as the EditText is shown normally on older Versions.

Regards, Kim

Micky
  • 5,578
  • 7
  • 31
  • 55
  • This is implemented in the Google+ app on Ice Cream Sandwich and it does not appear that it is using a custom background. The edittext view that is in focus has a blue underline while the edittext views that are not in focus have a grey underline. Has anyone figured out how to get this working without using a custom background? – Etienne Lawlor Jun 05 '12 at 01:00
  • possible duplicate of [android EditText blends into background](http://stackoverflow.com/questions/9900825/android-edittext-blends-into-background) – Aleks G Oct 25 '12 at 09:38

2 Answers2

1

I would recommend creating your own background for it. Another thing you can do is which may or may not work for your app's purpose is set that view to be focused by default. Just have your view call requestFocus() after it's loaded.

Frank Sposaro
  • 8,511
  • 4
  • 43
  • 64
  • requestFocus() is not an option for my app. maybe I stick with creatng a custom background. – Micky Feb 24 '12 at 09:07
  • Creating the background just worked fine. And it looks consistent over all Versions, which is fine for my project. Thank you. – Micky Feb 24 '12 at 09:55
1

If you add hint to the EditText then gray line should show up. You can also create custom theme by overriding the Holo theme but why confuse people with platform's behavior is the question.

RobGThai
  • 5,937
  • 8
  • 41
  • 59