Xamarin.forms: [Bug] Entry HorizontalTextAlignment does not work

Created on 22 Oct 2019  ·  37Comments  ·  Source: xamarin/Xamarin.Forms

Description

Setting HorizontalTextAlignment in an Entry does not work

Steps to Reproduce

  1. Add an Entry
                <Entry
                    Grid.Row="0"
                    Grid.Column="1"
                    FontSize="Large"
                    HorizontalTextAlignment="Center"
                    Keyboard="Numeric"
                    Placeholder="{utility:Translate Quantita}"
                    Text="{Binding Quantita}" />
  1. Set HotizontalTextAlignment to "Center"

Expected Behavior

Text should appear centered

Actual Behavior

It's left aligned

Basic Information

  • Version with issue: 4.3.0.908675
  • Last known good version: 4.2.0.xxxxx
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:

    • Android:
  • Affected Devices: Zebra TC51

Screenshots

Reproduction Link


image

4.3.0 regression Android bug

Most helpful comment

Bug is still present in Xamarin.Forms 4.3.0.991211. Going back to 4.2.0.910310, the Entry texts are aligned again. I wonder how such things can pass a release process? I mean, we all code day and night and mistakes happen - but this one looks like a very fundamental one.

All 37 comments

Is there a workaround?

I think you can try with a CustomRenderer… @czuvich

I think you can try with a CustomRenderer… @czuvich

It looks like Forms needs to set the Gravity along with the TextAlignment on the EditText. I was able to fix it.

It is working in previous version of Forms.

@acaliaro Can you please attach a small project that demonstrates this issue? Thanks!

It is working in previous version of Forms.

I can confirm that. It's a bug in XF 4.3.0.908675.

@acaliaro Can you please attach a small project that demonstrates this issue? Thanks!

HorizontalTextAlignment.zip

Can confirm, also got this bug after updating to 4.3.0.908675 in Android.

I have the same issue with 4.3.0.947036. Android only.

Same issue for me (android only) after updating to 4.3.0 !

image

add me to the list of users running into this same issue.

Add me to the list of users as well.

Same problem here.

Also add me to the list of users as well.

Same here

Bug is still present in Xamarin.Forms 4.3.0.991211. Going back to 4.2.0.910310, the Entry texts are aligned again. I wonder how such things can pass a release process? I mean, we all code day and night and mistakes happen - but this one looks like a very fundamental one.

The workaround I posted “fixed” it for me.

@czuvich thanks. I already have a bunch of custom renderers for such fixes...

can't roll back, just sold the business on the new CollectionView, and it wasn't quite right in 4.2 😆.
@czuvich if you've been able to successfully resolve this within the renderer, how would you feel about submitting a PR? I'm sure it'd be welcomed by the Forms team.

@ChaseFlorell It's just a temporary "hack". They will likely fix it differently. I'm not an Android expert :)

Things breaking here and there after upgrading to newer version of Forms has been a tradition since the beginning.

Here's a fast fix that worked for me - it was suggested elsewhere (can't remember the ticket #). This is for those who already have a thousand renderers fixing other things and don't want to add another. Add the following to manifest (in the application tag):

android:supportsRtl="true"

Things breaking here and there after upgrading to newer version of Forms has been a tradition since the beginning.
Here's a fast fix that worked for me - it was suggested elsewhere (can't remember the ticket #). This is for those who already have a thousand renderers fixing other things and don't want to add another. Add the following to manifest (in the application tag):
android:supportsRtl="true"

Realy?

As suggested by @nkuznetsov, android:supportsRtl="true" work for me

Yeah the manifest update fixed it for me also:

Same issue here. Is there a plan to solve it in a Form bugfix version or do we rly need to make some dirty workaround fixes like android:supportsRtl="true" ?

This has a 4.3 release label but I don't see any PR linked. Is this actually being fixed?

Works to me with android:supportsRtl="true" workaround.

Do not work to me. I am targeting to Android >= 6.

Em ter., 10 de dez. de 2019 às 10:20, cauefelipe11 notifications@github.com
escreveu:

Works to me with android:supportsRtl="true" workaround.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/xamarin/Xamarin.Forms/issues/8140?email_source=notifications&email_token=ALBH3YGL3CACB2T2SFS5QADQX6JRJA5CNFSM4JDK4HPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGPGKNQ#issuecomment-564028726,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ALBH3YBXRYI4YVKGSVQ5KW3QX6JRJANCNFSM4JDK4HPA
.

This is fixed by #8658 and should be in an upcoming service release for 4.3.

@hartez are you sure it's in 4.3? The bug still appears to be present in 4.4.0.991265.

@hartez are you sure it's in 4.3? The bug still appears to be present in 4.4.0.991265.

Yes. The change was merged into the 4.3 branch 8 days ago and the 4.4 branch 6 days ago. 4.4.0.991265 was pushed to NuGet 7 days ago, so if the changes were in that version we'd have bigger problems than text alignment :)

The changes didn't make the last service release for 4.3; they should be in the next one. And an upcoming service release for 4.4.

I'm on 4.4.0.991265 and the bug is still present. I'm still using the supportsRtl workaround in the meantime.

Add the following to manifest (in the application tag):
android:supportsRtl="true"

Hooray! It seems to be solved in Xamarin.Forms 4.4.0.991537 👍

closed 18 hours ago, so i have to update now !, i hope this will not impacts the other features

Was this page helpful?
0 / 5 - 0 ratings