RadioButton 在带有浅色主题的 Android 10/11 上不可见

man*_*ani 5 android radio-button xamarin.android xamarin xamarin.forms

我们在 Xamarin Forms 中使用新的实验性单选按钮: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/radiobutton

Xamarin.Forms 版本 - 4.8.0.1269

单选按钮在 Android 9 及更低版本的设备中完美运行。但在 Android 10/11 上,如果手机主题设置为浅色主题,则单选按钮图标会丢失。以下分别是深色和浅色主题的示例屏幕截图:

模拟器上的深色主题

三星设备上的浅色主题

这是为单选按钮编写的代码:

                    <StackLayout VerticalOptions="Start" 
                                 HorizontalOptions="FillAndExpand">

                        <Label Text="Body temperature"
                               Style="{StaticResource BlackBoldLabelStyle}"
                               VerticalOptions="Start"
                               HorizontalOptions="StartAndExpand" />

                        <StackLayout VerticalOptions="Start" 
                                     Margin="0,10,0,0"
                                     HorizontalOptions="FillAndExpand"
                                     Orientation="Horizontal">
                            <StackLayout.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding OnBodyTempOption1Click}"/>
                            </StackLayout.GestureRecognizers>

                            <RadioButton
                                   HorizontalOptions="Start"
                                   VerticalOptions="Center" 
                                   IsChecked="{Binding IsBodyTempOption1Check}"/>

                            <Label Text="Less than 99.5 degree F / 37.5 degree C"
                                   VerticalOptions="Center"
                                   Style="{StaticResource DarkGrayLabelStyle}"
                                   HorizontalOptions="StartAndExpand" />
                        </StackLayout>

                        <StackLayout VerticalOptions="Start" 
                                     Margin="0,5,0,0"
                                     HorizontalOptions="FillAndExpand"
                                     Orientation="Horizontal">
                            <StackLayout.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding OnBodyTempOption2Click}"/>
                            </StackLayout.GestureRecognizers>

                            <RadioButton
                                   HorizontalOptions="Start"
                                   VerticalOptions="Center" 
                                IsChecked="{Binding IsBodyTempOption2Check}"/>

                            <Label Text="More than 99 degree F / 37 degree C"
                               VerticalOptions="Center"
                                   Style="{StaticResource DarkGrayLabelStyle}"
                               HorizontalOptions="StartAndExpand" />
                        </StackLayout>
                    </StackLayout>
Run Code Online (Sandbox Code Playgroud)

请帮助解决如何解决单选按钮可见性问题。

Cfu*_*fun 5

当 Xamarin.Fomrs 开发团队致力于解决此问题时,您可以应用以下解决方法,在 Android 中styles.xml设置以下属性:

<item name="android:colorControlNormal">#FF4081</item>
Run Code Online (Sandbox Code Playgroud)

这将为圆圈设置颜色RadioButton