I couldn't believe that, but i didn't feel good after reading the source code - they really don't consider such a case for a PopUp in error message.
FYI, See showError()
of Editor
class and methods used as arguments below:
mErrorPopup.showAsDropDown(mTextView, getErrorX(), getErrorY());
mErrorPopup.fixDirection(mErrorPopup.isAboveAnchor());
Painful reality. I guess the wayout is straightforward: write custom error popUp. However, it's too time consuming for such a minor important UI-part (in most cases). If your TextView
is wide enough, I'd just use multilined text. Another option (I didn't try it myself, honestly) is to play with LTR-RTL settings - as souce code shows, the , see the source code:
/**
* Returns the X offset to make the pointy top of the error point
* at the middle of the error icon.
*/
private int getErrorX() {
/*
* The "25" is the distance between the point and the right edge
* of the background
*/
final float scale = mTextView.getResources().getDisplayMetrics().density;
final Drawables dr = mTextView.mDrawables;
final int layoutDirection = mTextView.getLayoutDirection();
int errorX;
int offset;
switch (layoutDirection) {
default:
case View.LAYOUT_DIRECTION_LTR:
offset = - (dr != null ? dr.mDrawableSizeRight : 0) / 2 + (int) (25 * scale + 0.5f);
errorX = mTextView.getWidth() - mErrorPopup.getWidth() -
mTextView.getPaddingRight() + offset;
break;
case View.LAYOUT_DIRECTION_RTL:
offset = (dr != null ? dr.mDrawableSizeLeft : 0) / 2 - (int) (25 * scale + 0.5f);
errorX = mTextView.getPaddingLeft() + offset;
break;
}
return errorX;
}
As you see, the RTL setting doesn't care about TextView width, if you play with it, maybe you'll find the way to set the arrow al the left side.
See also this topic