android-prefix-suffix-edit-text
android-prefix-suffix-edit-text copied to clipboard
When setting gravity center prefix is shown in the beginning
Is it possible to support
android:textAlignment="center"
android:gravity="center"
as for now, the prefix is not moving to the center if I change android:textAlignment
or android:gravity
That's by intention.
In order to support android:textAlignment="center"
as you need, some rework will be required as the prefix is currently set as a `CompoundDrawable``. See
https://github.com/tobiasschuerg/android-prefix-suffix-edit-text/blob/06af89364fce14795372e5d1d47c116933390f06/library/src/main/java/com/tobiasschuerg/prefixsuffix/PrefixSuffixEditText.kt#L114
Alternatively, as a quick workaround you might wan to put the TextView
into some container and set its width to wrap_content
and center the view inside the container:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.tobiasschuerg.prefixsuffix.PrefixSuffixEditText
android:id="@+id/edit_text_dollar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Still PRs are welcome.