【问题标题】:How can I prevent white screen between page transitions in Android?如何防止Android中页面转换之间的白屏?
【发布时间】:2017-10-09 05:11:18
【问题描述】:

我注意到我的适用于 Android 的 Xamarin.Forms 应用程序在页面转换之间暂时显示白屏。在启动和页面加载之间,我想知道在 Xamarin.Forms 中处理这种情况的最佳方法是什么?

我在资源样式中尝试了这些设置,但没有成功:

<style name="AppDefaultTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowDisablePreview">true</item>
  </style>

在我的清单中:

<application 
android:label="App" 
android:icon="@drawable/AppIcon" 
android:theme="@style/AppDefaultTheme">

以前有人遇到过这种情况吗?你最好的方法是什么?

【问题讨论】:

    标签: c# android xamarin xamarin.forms


    【解决方案1】:

    这里有一篇关于 Xamarin.Android 页面转换的精彩文章:

    http://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/

    我最好的方法是 Xamarin MVVM 方式与启动画面和 MainLauncher 活动颜色相结合:

    <style name="Theme.Splash" parent="android:Theme">
         <item name="android:windowBackground">@drawable/splash</item>
         <item name="android:windowNoTitle">true</item>
    </style>
    

    #ffffff

    <style name="AppMainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowBackground">@color/AppBackgroundColor</item>
    </style>
    

    对于 MVVM Xamarin 方式,我指的是首先显示您可以显示的最简单的 UI 和显示加载指示器,以让用户知道在您从 ws 或其他东西进行异步/等待调用时在后台发生了一些事情需要时间,以 Slack 应用为例:

    这就是您的页面转换将如何最小化并为您的应用创建更稳定的用户体验的方式。

    您也可以按照 Jason Smith 的技术来创建更快的 UI:

    http://kent-boogaart.com/blog/jason-smith's-xamarin-forms-performance-tips

    【讨论】:

    • 感谢您的回答。我可以让启动画面正常工作,但不能让页面转换。
    • 我认为是表单的问题,我在新版本的表单中有白屏过渡
    • 有没有人找到解决办法。简单地从一个页面导航到另一个页面(然后返回)总是会闪烁白屏。
    • @Valerie 您可以更改这些过渡的颜色。
    猜你喜欢
    • 2018-10-28
    • 2017-09-19
    • 1970-01-01
    • 2014-11-07
    • 2015-01-24
    • 2017-06-21
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    相关资源
    最近更新 更多