针对Android,Windows和Windows Phone的应用程序时,可以更改应用程序的配色方案。 在这种情况下,ContentPage的BackgroundColor和Label的TextColor属性的Color.Default的设置将有不同的含义。
有几种方法可以在Android中设置配色方案,但最简单的方法只需要在Android项目的Properties文件夹的AndroidManifest.xml文件中设置一个属性设置。 该文件通常如下所示:
点击(此处)折叠或打开
-
<manifest xmlns:android="">
-
<uses-sdk android:minSdkVersion="15" />
-
<application>
-
</application>
- </manifest>
点击(此处)折叠或打开
-
<manifest xmlns:android="">
-
<uses-sdk android:minSdkVersion="15" />
-
<application android:theme="@style/android:Theme.Holo.Light">
-
</application>
- </manifest>
对于三个Windows和Windows Phone项目,您需要更改位于特定项目中的App.xaml文件。
在UWP项目中,默认的App.xaml文件如下所示:
点击(此处)折叠或打开
-
<Application
-
x:Class="Baskervilles.UWP.App"
-
xmlns=""
-
xmlns:x=""
-
xmlns:local="using:Baskervilles.UWP"
-
RequestedTheme="Light">
- </Application>
Windows Phone 8.1和Windows 8.1项目的App.xaml文件类似,但默认情况下不包含RequestedTheme属性。 这是WinPhone项目中的App.xaml文件:
点击(此处)折叠或打开
-
<Application
-
x:Class="Baskervilles.WinPhone.App"
-
xmlns=""
-
xmlns:x=""
-
xmlns:local="using:Baskervilles.WinPhone">
- </Application>
通过在Windows Phone和Windows项目上设置RequestedTheme,您的应用程序应该对所有平台上的底层颜色方案有完整的了解。