Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When setting gravity center prefix is shown in the beginning #6

Open
ghost opened this issue Mar 27, 2020 · 1 comment
Open

When setting gravity center prefix is shown in the beginning #6

ghost opened this issue Mar 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Mar 27, 2020

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

@tobiasschuerg
Copy link
Owner

tobiasschuerg commented Mar 28, 2020

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

setCompoundDrawablesRelative(prefixDrawable, null, null, null)

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 tobiasschuerg added the enhancement New feature or request label Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant