For EditText that going be filled with RTL text, is there a way to change the gravity of the error drawable (and popup of course) ?
here is an example of regular error drawable
so since the text entered is RTL i would like the pop up to show up at the LEFT side of the EditText
i tried to apply custom drawable , but Drawable doesnt seem to have any setGravity method.
thanks in advance.
It's not possible by normal means, however you can extend the Android TextView class and change the layout that Android uses to inflate the popup. I haven't tried this myself but it could work.
I did a quick look in the source of TextView and found this line
final TextView err = (TextView) inflater.inflate(com.android.internal.R.layout.textview_hint,
null);
Which references to this layout.
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/popup_inline_error"
android:textAppearance="?android:attr/textAppearanceSmallInverse"
/>
Adding gravity here could do the trick. A similar approach for the drawable could apply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With