38
votes

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?

3

3 Answers

74
votes

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" />
8
votes

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.

0
votes

open android manifest file app_name->Properties->AndroidManifest.xml

now add this line inside <manifest>:

<manifest>
    ...
    <application android:theme="@android:style/Theme.DeviceDefault.Light"></application>
    ...
</manifest>