Open kerberosargos opened 4 years ago
Confirmed
XAML
<sc:SegmentedControl Grid.Column="1" BackgroundColor="LightGray" FontSize="12" HorizontalOptions="FillAndExpand" ItemsSource="{Binding MeasuresTypes}" SelectedSegment="{Binding MeasuresType, Mode=TwoWay}" SelectedTextColor="{StaticResource Material.Color.OnSecondary}" TextColor="{StaticResource Material.Color.OnBackground}" TintColor="{StaticResource Material.Color.Secondary}" VerticalOptions="FillAndExpand" />
Xamarin Forms: 4.5 Platform: ANDROID
Related to #69?
The reason the heightRequest="30"
makes it look correct is because this is a hard coded value here.
Is there a way to get this to adjust automatically?
Thx @Hackmodford.
There probably is, but I don't currently know how. Feel free to look at it and create a PR.
I think I've solved this, but I'm not familiar with Android development, so there may be a better way.
In SegmentedControlRenderer.cs, modify the ConfigureRadioButton method to the following:
if (!(selectedShape is null))
{
selectedShape.SetStroke(borderWidthInPixel, borderColor);
selectedShape.SetColor(backgroundColor);
selectedShape.SetSize(0, ConvertDipToPixel(Element.HeightRequest));
}
if (!(unselectedShape is null))
{
unselectedShape.SetStroke(borderWidthInPixel, borderColor);
unselectedShape.SetColor(_unselectedItemBackgroundColor);
unselectedShape.SetSize(0, ConvertDipToPixel(Element.HeightRequest));
}
I need to do some more testing but I'll create a PR for this once I'm sure it's working. Seems strange that I can pass 0 as the value for the width to SetSize but it still works.
Confirmed. Anyone still working on this plugin?
Hello, firstly thank you for your good work. When I implement your plugin to Android height property does not seem correct. If I add
HeightRequest="30"
It seems good. Thank you in advance.