MicroSugarDeveloperOrg/Avalonia.WebView

There are some small issues

Opened this issue · 1 comments

  • 我发现,当WebView未设置Url时,原生平台的控件好像不会被加载,此时,整个View背景颜色是黑色的。所以,就算一开始设置了Url,WebView也会先显示黑色背景,然后在显示网页。我尝试了设置Backgroud,EmptyViewer和config.DefaultWebViewBackgroundColor = System.Drawing.Color.Red;但是都没有效果(始终显示黑色)
    I found that when WebView is not set to Url, native platform controls do not seem to be loaded, and at this point, the entire View background color is black. So, even if Url is initially set, WebView will first display a black background before displaying the webpage. I tried setting up Background, EmptyViewer, and Config DefaultWebViewBackgroundColor=System Drawing Color Red; But none of them had any effect (always displaying black)

  • 如何设置UserAgent
    How to set up UserAgent

调试了下,发现黑屏可能是原生控件的问题,初始化时会黑屏一会。我使用了一个不算优雅的方式来解决这个初始化黑屏的问题(初始化的时候,设置控件宽高为1,等初始化完成后,再修改为正常大小)

修改前动图:
before2

修改后动图:
after2

修改代码:
cccccccc

不知道有没有更好的办法...