3

I want to create customize errorText of EditText with meaning full border.

editeText.setError(" ");

gives error message with red border which is good for showing it's required or validating field.

I've created customize error message with only icon difference in it.

Snipped used to change the icon of error message:-

    final Drawable error_indicator;
    error_indicator = getResources().getDrawable(R.drawable.error_icon_mdpi);
    int left = 0;
    int top = 0;
    int right = error_indicator.getIntrinsicHeight();
    int bottom = error_indicator.getIntrinsicWidth();
    error_indicator.setBounds(new Rect(left, top, right, bottom));
    addSxName.setError("Enter patient name in here", error_indicator);

Here its what it looked like.

What i got

What I'm looking for:-

What I'm looking for

But as a ToolTip or something that red border is little bit eye catcher.

Can we modify the modify of that errorBox?

Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
  • you can create your drawable and then set to error Message, see this link to understand better, http://stackoverflow.com/questions/5218691/how-to-display-input-errors-in-popup – Shayan Pourvatan Jan 13 '14 at 07:48
  • @Shayanpourvatan : Where you guiding I've created from that link only. But I'm looking to change the border around `error()` from red to green. Any suggestion are most welcome. – Vikalp Patel Jan 13 '14 at 07:54
  • can you create one drawable with green border and set to your error message? did you test that? – Shayan Pourvatan Jan 13 '14 at 08:00
  • you have to set border of edittext ? – dipali Jan 13 '14 at 08:40
  • @VikalpPatel did you solve this..i am lloking for same answer –  Jan 13 '15 at 12:23
  • @Johnson : I'vent implemented further on these. But you can achieve customize error box using custom pop up box/alert dialog. – Vikalp Patel Jan 14 '15 at 05:11

1 Answers1

2

Its not possible

Alternate solution

  1. Dont use setError()
  2. Create custom popup window
  3. create your own set error method and show the popup window there
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243