android-prefix-suffix-edit-text icon indicating copy to clipboard operation
android-prefix-suffix-edit-text copied to clipboard

When setting gravity center prefix is shown in the beginning

Open Coinfo opened this issue 4 years ago • 1 comments

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

Coinfo avatar Mar 27 '20 09:03 Coinfo

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.

tobiasschuerg avatar Mar 28 '20 07:03 tobiasschuerg