Solution 1 :
While Xamarin.Fomrs dev team working on this issue you can apply the following workaround, in Android styles.xml
set the following attribute:
<item name="android:colorControlNormal">#FF4081</item>
which will set a color to the RadioButton
circle.
Problem :
We are using the new experimental radio button in Xamarin Forms:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/radiobutton
Xamarin.Forms version – 4.8.0.1269
The radio buttons work perfectly in Android 9 and lower devices.
But on Android 10/11, if the phone theme is set to Light theme, the Radio button icon goes missing.
Here are the sample screenshots from both dark and light themes respectively:
And here is the code written for the radio buttons:
<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>
Please help on how to fix the issue with the radio button visibility.
Comments
Comment posted by nevermore
I did not reproduce the problem on my side while I get an other problem. Does it work in a lower Xamarin.forms version? RadioButton is currently experimental and you can report this problem in Github.
Comment posted by nevermore
OK, once you find a solution, you can also share here.
Comment posted by github.com/xamarin/Xamarin.Forms/issues/11700
There are currently known issues with Radio Button & Android platform with the release of Xamarin Forms 4.8.
Comment posted by Cfun
Could you give a feedback if this issue is still reproducible or no?
Comment posted by manishKungwani
@Cfun It was due to the light/dark theme.
Comment posted by Thamarai T
For Xamarin.Forms version 5.0.0.2012, this issue exists.
Comment posted by Thamarai T
this workaround adds the tint color to all editable controls.