1

I have a standard (not custom, no layout) AlertDialog with literally just an EditText as its view and two buttons (OK and cancel.)

When there's a problem with the input, I show an error message that ends up being three lines of text, which occludes the OK and cancel buttons. The error text does disappear once the user types something, but I'd sure like the cancel button to be visible.

Is there any (easy) way of changing the placement of the error text?

Jeff Axelrod
  • 27,676
  • 31
  • 147
  • 246
  • 2
    I also hit this problem. Sounds like a bug in the framework. The EditText code should be smarter about rendering the popup. I filed Android issue 30602: http://code.google.com/p/android/issues/detail?id=30602 – Boris Burtin May 09 '12 at 17:59

1 Answers1

3

Unfortunately, not without some customization. The internal PopupWindow managed for the error display is called with showAsDropDown(), which let's Android decide where to display the view in relation to it's anchor (the error icon, in this case) and it will always be below the view unless there is not enough window space. You would have to create (albeit fairly simple) subclass of EditText that displays the internal PopupWindow using showAtLocation() instead.

Here's the link to the TextView source to hopefully help out if you want to try that. The setError() and showError() methods are what you would be after overriding.

HTH

devunwired
  • 62,780
  • 12
  • 127
  • 139