Xamarin.Forms does generate a greyish Android application. I'd like to have a light / white theme in Android (like in the iOS target).
Does a simple way to switch exist?
If you want to disable the dark mode for your entire application you can add the key below in the info. plist: <key>UIUserInterfaceStyle</key> <string>Light</string>
Set the current user themeDark; In this example, the application is set to use the theme defined for the system dark mode, regardless of which system theme is currently operational. Set the UserAppTheme property to OSAppTheme. Unspecified to default to the operational system theme.
A ResourceDictionary is a repository for resources that are used by a Xamarin. Forms application. Typical resources that are stored in a ResourceDictionary include styles, control templates, data templates, colors, and converters.
You can put Theme parameter to ApplicationAttribute of your main activity
like this
[assembly: Application(Icon = "@drawable/Icon", Theme = "@android:style/Theme.Holo.Light")]
Or you can put this string to AndroidManifest.xml
<application android:theme="@android:style/Theme.Holo.Light" />
The answer from ad1Dima got me most of the way there, but I found that in my environment I needed something slightly different. This is what I put in my 'MainActivity.cs' file to change the theme.
[Activity( Theme="@android:style/Theme.Holo.Light",Label = "HealthTechnologies", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : AndroidActivity
Note that the only thing that was new here was the addition of the 'Theme=...'. Everything else was already in the MainActivity.cs file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With