alexrainman / SegmentedControl

MIT License
86 stars 38 forks source link

Android SegmentedControl strange shape #29

Closed kingsj0405 closed 7 years ago

kingsj0405 commented 7 years ago

In Android

SegmentedControl

But in iOS, it works well. Is there any problem with android?

Here is code as following:

<StackLayout
                HeightRequest="50"
                Orientation="Horizontal">

                <Label
                    Margin="10,10,10,10"
                    VerticalOptions="CenterAndExpand"
                    Text="Range"/>
                <controls:SegmentedControl
                    Margin="10,10,10,10"
                    VerticalOptions="CenterAndExpand"
                    TintColor="#000000">
                    <controls:SegmentedControl.Children>
                        <controls:SegmentedControlOption
                            Text="Date" />
                        <controls:SegmentedControlOption
                            Text="Modality" />
                    </controls:SegmentedControl.Children>
                </controls:SegmentedControl>

                <Label
                    Margin="10,10,10,10"
                    VerticalOptions="CenterAndExpand"
                    Text="Date"/>
                <controls:SegmentedControl
                    Margin="10,10,10,10"
                    VerticalOptions="CenterAndExpand"
                    TintColor="#000000">
                    <controls:SegmentedControl.Children>
                        <controls:SegmentedControlOption
                            Text="Show" />
                        <controls:SegmentedControlOption
                            Text="Hide" />
                    </controls:SegmentedControl.Children>
                </controls:SegmentedControl>
            </StackLayout>
kingsj0405 commented 7 years ago

The problem is resolved by adding WidthRequest="200" to controls:SegmentedControl. It seems there is view problem when number of text line is larger than 1.

alexrainman commented 7 years ago

If you add HorizontalLayoutOptions this problem will be solved.