RadioButton 在 Android 10/11 浅色主题上不可见
RadioButton not visible on Android 10/11 with light theme
我们在 Xamarin Forms 中使用新的实验性单选按钮:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/radiobutton
Xamarin.Forms 版本 - 4.8.0.1269
单选按钮在 Android 9 及更低版本的设备中完美运行。
但是在 Android 10 月 11 日,如果 phone 主题设置为浅色主题,则单选按钮图标会丢失。
以下分别是深色和浅色主题的示例屏幕截图:
下面是为单选按钮编写的代码:
<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>
请帮助解决单选按钮可见性问题。
当 Xamarin.Fomrs 开发团队在 this issue 上工作时,您可以应用以下解决方法,在 Android styles.xml
中设置以下属性:
<item name="android:colorControlNormal">#FF4081</item>
这将为 RadioButton
圆圈设置颜色。
我们在 Xamarin Forms 中使用新的实验性单选按钮: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/radiobutton
Xamarin.Forms 版本 - 4.8.0.1269
单选按钮在 Android 9 及更低版本的设备中完美运行。 但是在 Android 10 月 11 日,如果 phone 主题设置为浅色主题,则单选按钮图标会丢失。 以下分别是深色和浅色主题的示例屏幕截图:
下面是为单选按钮编写的代码:
<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>
请帮助解决单选按钮可见性问题。
当 Xamarin.Fomrs 开发团队在 this issue 上工作时,您可以应用以下解决方法,在 Android styles.xml
中设置以下属性:
<item name="android:colorControlNormal">#FF4081</item>
这将为 RadioButton
圆圈设置颜色。