Search code examples
androidandroid-edittextandroid-themeerrortemplate

Customise error text border android on EditText


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?


Solution

  • 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