0

I have a Drawable that I am trying to set as an icon for the error message of an EditText.

Drawable drawable = getResources().getDrawable(R.drawable.question_mark);
EditText editText = (EditText) rootView.findViewById(R.id.pan_card_num);
editText.setError("Hello",drawable);

However, when I do the above, it ends up looking blank like this:

enter image description here

That is, the error message Hello is displayed, but the icon is not. It might be important to mention that the drawable R.drawable.question_mark is a png file in the drawable folders.

nurealam11
  • 537
  • 4
  • 16
u3l
  • 3,342
  • 4
  • 34
  • 51

1 Answers1

0

The only issue I see is that the Business PANCard textfield is overlaying over the question mark image. I would make the textView smaller, to leave space for the image to be shown.

Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79
  • That's not possible, because `EditText#setError`places the image on top. of the Text View, within its bounds. If I took out the `drawable` parameter from the method, it would display the default "exclamation mark" image on top. I'm just trying to replace that image, which is definitely on top of the text view. In fact, if I tap the blank spot, the message `hello` displays. If it was behind the `TextView` that wouldn't be possible. – u3l Jun 05 '14 at 12:21