简体   繁体   English

在内容页面中加载webview会首先在Android中的xamarin表单中显示页面

[英]Loading webview in content page shows page first in xamarin forms in Android

I am creating Xamarin Forms application which targets iOS and Android. 我正在创建针对iOS和Android的Xamarin Forms应用程序。 We are showing web view on content page when application loads having login page. 当应用程序加载具有登录页面时,我们在内容页面上显示Web视图。 In iOS, when application loads, it directly loads webview on content page but in Android, it fist loads content page for 2-3 seconds and then loads web view which looks very bad in terms user experience. 在iOS中,当应用程序加载时,它会直接在内容页面上加载webview,但在Android中,它会加载内容页面2-3秒,然后加载Web视图,这在用户体验方面看起来非常糟糕。

Below is content page which only contains webview. 以下是仅包含webview的内容页面。 But before loading webview control on screen, it shows below screen with application name, header bar and blank body for Android environment. 但是在屏幕上加载webview控件之前,它会显示以下屏幕,其中包含Android环境的应用程序名称,标题栏和空白正文。

在此输入图像描述

Questions: 问题:

Is there any way we can directly load webview in android? 有什么办法可以直接在android中加载webview吗? or can we add some good UI for android? 或者我们可以为Android添加一些好的UI吗?

That is probably because that is normally where some kind of splash screen would live. 这可能是因为通常会出现某种闪屏。

If you create a style something like this: 如果你创建一个这样的样式:

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

And apply it to your activity like: 并将其应用于您的活动,例如:

[Activity(Label = "MyApp", Icon = "@drawable/ic_launcher", Theme = "@style/Theme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : Activity

Then it should be gone. 然后它应该消失。 If you have a theme already, just add the XML inside the style tags to the current theme. 如果您已有主题,只需将style标记内的XML添加到当前主题即可。

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

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