Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 404
Vikalp Patel Avatar asked Mar 09 '26 21:03

Vikalp Patel


1 Answers

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
like image 67
Sunil Kumar Sahoo Avatar answered Mar 12 '26 11:03

Sunil Kumar Sahoo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!