我正在尝试我在移动的上开发的Xamarin Forms应用程序,该应用程序处于黑暗模式。
我不知道这是否与此有关,但我将启动画面的背景色设置为白色。这是splash_screen.xml
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/launcher_background"/>
</item>
<item>
<bitmap
android:src="@drawable/logo1_100x153"
android:tileMode="disabled"
android:gravity="center"/>
</item>
</layer-list>
字符串
然后在样式上我添加了Theme.AppCompat.Light.NoActionBar
,就像我在MainTheme
上一样,因为我不知道黑暗模式会影响我的应用程序上的颜色。
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- As of Xamarin.Forms 4.6 the theme has moved into the Forms binary -->
<!-- If you want to override anything you can do that here. -->
<!-- Underneath are a couple of entries to get you started. -->
<!-- Set theme colors from https://aka.ms/material-colors -->
<!-- colorPrimary is used for the default action bar background -->
<!--<item name="colorPrimary">#2196F3</item>-->
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#000000</item>
<item name="android:forceDarkAllowed">false</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<!--<item name="colorAccent">#FF4081</item>-->
</style>
<style name="MyTheme.Splash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionBar">true</item>
</style>
</resources>
型
然后这是它在我手机上的显示
的数据
有人知道怎么修吗?请帮助和感谢。
1条答案
按热度按时间hujrc8aj1#
你试过直接设置颜色吗?
字符串
完整代码:
型