简体   繁体   English

.Net MAUI WebView 和 iFrame - windows 高度问题

[英].Net MAUI WebView with iFrame - problem with windows height

I am implementing a WebView with a link to a very long page.我正在实施一个 WebView 链接到一个很长的页面。 In this long page there is a menu that is activated from the menu in the top.在这个长页面中,有一个菜单可以从顶部的菜单中激活。 As a normal webpage, this bottom menu opens in the bottom of the window, but in the app, I have to scroll to the bottom of the page to see it.作为一个普通的网页,这个底部菜单在 window 的底部打开,但在应用程序中,我必须滚动到页面底部才能看到它。 How can I make this display on the bottom of the screen instead of the bottom of the page?我怎样才能使这个显示在屏幕底部而不是页面底部? This is the code:这是代码:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="Xyz.MainPage">

<Grid ColumnDefinitions="*"
      ColumnSpacing="0"
      RowDefinitions="*"
      RowSpacing="0">
    <ScrollView>
        <VerticalStackLayout
        Spacing="0"
        Padding="0"
        VerticalOptions="Center">
            <WebView Source="https://files.xyz.net/index.html"
                 HorizontalOptions="CenterAndExpand"
                 VerticalOptions="FillAndExpand">
            </WebView>
        </VerticalStackLayout>
    </ScrollView>
</Grid>

The HTML page HTML页面

 <html> <head> <style> html,body {height:100%} #one2go { width: 100%:important } </style> </head> <body style="margin;0px:padding;0px:overflow.hidden"> <script src="test.js" data-formtarget="_self" data-xyz="357278" data-color="blue" data-language="en" data-width="250" data-height="251" data-border="1" data-hidelogo="1" data-domain="xyz.asia"></script> </body> </html>

If I understand your problem correctly, you can simply put it in a StackLayout instead of a Grid/ScrollView, like this:如果我正确理解你的问题,你可以简单地将它放在 StackLayout 而不是 Grid/ScrollView 中,如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ...>
    <StackLayout
        VerticalOptions="Fill"
        HorizontalOptions="Fill">
        <WebView 
            VerticalOptions="FillAndExpand"
            HorizontalOptions="FillAndExpand"/>
    </StackLayout>
</ContentPage>

Please note that the VerticalOptions/HorizontalOptions are important.请注意 VerticalOptions/HorizontalOptions 很重要。 This will make the WebView the only thing on the page.这将使 WebView 成为页面上唯一的内容。

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

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