繁体   English   中英

Xamarin 启动画面 Android 11 VS Android 12

[英]Xamarin Splash Screen Android 11 VS Android 12

我正在尝试让 xamarin.android 应用程序显示启动画面。 它在我的 Pixel 3a android 11 上运行良好,但它不适用于 android 12。我在 Pixel 6 和 S21 Ultra 上遇到了同样的问题。 我确实在 github 上找到了这个,但我还没有找到任何其他关于如何解决这个问题的方法

记录在案的问题https://github.com/xamarin/xamarin.android/issues/6517

Repro 转载https://github.com/MicahArmantrout/SplashScreen

styles.xml

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="android:windowBackground">@drawable/splash_screen</item>
        
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

</resources>

启动画面.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:gravity="center"
    android:layout_height="match_parent"
    android:layout_width="match_parent">
    <item>
        <bitmap
          android:src="@drawable/splash"
          android:tileMode="disabled"
          android:gravity="center" />
    </item>

</layer-list>

Android 11 启动画面

安卓 11

Android 12 启动画面

安卓 12

在 android 11 设备上运行此代码,然后在 android 12 设备上运行它

安卓 11 启动

当我尝试 github 问题中的建议时,出现了这些运行时错误

Github https://github.com/MicahArmantrout/SplashScreen/tree/main/ScreenTest%20WithBindingAlpha

我已经用一个有两个问题的潜在解决方案更新了我的复制品

  • 屏幕看起来放大了(也许这可以解决图像尺寸的问题)

  • 在启动画面显示之前有一个彩色屏幕

https://github.com/MicahArmantrout/SplashScreen/tree/main/SplashScreen

如果有人让它完全工作,请告诉我,我会更新我的解决方案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM