HITGIF / TextFieldBoxes

Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prefix and suffix are not shown when endIcon is set

natario1 opened this issue · comments

Just as per title.

If I set an endIcon the prefix and suffix are not drawn anymore (the text drawable does not go through onDraw). Why is this?

More info:

  • call setPrefix("something") - this sets the left compound drawable
  • call setEndIcon - this calls updateClearAndEndIconLayout()

In that method you ask for getCompoundDrawablesRelative().
I would expect the first one (or third for RTL) to be the prefix drawable, instead, it is null.
If you replace getCompoundDrawablesRelative() with getCompoundDrawables(), the first one is correctly not null. I don't know why.

Also for RTL devices (not my case) this method explicitly replaces the prefix drawable with the password toggle dummy drawable, because left == end. To avoid all this I think that the EditText should not use compound drawables but rather padding and draw onDraw.