alexrainman / SegmentedControl

MIT License
86 stars 38 forks source link

Text becoming left aligned after tap #60

Closed pfiggins closed 6 years ago

pfiggins commented 7 years ago

I have a strange issue where once tapped, my segmented control text becomes left aligned.

Before - seg_orig

After - seg_left

Any ideas?

pfiggins commented 7 years ago

Just wanted to circle back and let you know that it's being caused by handling the ValueChanged event. If I take that handler off the event, everything is fine. So it must be some sort of timing issue. Either way, for now what I have found to work is to make the control invisible and then visible. This causes a redraw and the text is again centered as expected.

alexrainman commented 7 years ago

Will take a look.

alexrainman commented 7 years ago

I cannot reproduce this. Can you tell me device and OS?

zanesc commented 6 years ago

This issue has been reported before. I even found a workaround once, but now even that does not work. Back to text being left aligned only happens on Android.

https://github.com/alexrainman/SegmentedControl/issues/59 https://github.com/alexrainman/SegmentedControl/issues/41 https://github.com/alexrainman/SegmentedControl/issues/30

EDIT: Suggestion from https://github.com/alexrainman/SegmentedControl/issues/30 about setting the RowDefinition height to 60 has worked for me now.

alexrainman commented 6 years ago

This is more a Xamarin.Forms issue than the control itself. Thats why setting the HeightRequest fix it.

pfiggins commented 6 years ago

So what is the best workaround then? Can you implement something in the control to ensure it redraws properly? I'm still seeing this on any redraw and it's pretty annoying to have to hook into any event that may cause a redraw and make sure I hide/show this control. No other controls have this issue, so either they work around it or it's something specific to how this control operates.

pfiggins commented 6 years ago

Oh, and sorry I missed your earlier request. I'm personally seeing this on Android with genymotion generic tablets running api 23 and 25. I haven't really paid attention to which physical tablets do/don't have the issue.