c# - 将 xaml 用于 xamarin forns 项目时出现错误,并且在呈现控件时出现异常
问题描述
在此处输入图像描述我正在制作一个应用程序,它只需使用按钮请求一个 url,我想在一个不起作用的 WebView 上显示 url 的内容
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SAT"
x:Class="SAT.MainPage">
<StackLayout VerticalOptions="Center"
BackgroundColor="#3C3838">
<Button Text="On\\Off"
BackgroundColor="#6FD761"
Margin="70,240,70,0"
x:Name="ToggleRelay1"
Clicked="ToggleRelay1_Clicked"/>
<Button Text="On\\Off"
BackgroundColor="#6FD761"
Margin="70,20,70,0"
x:Name="TggleRelay2"
Clicked="TggleRelay2_Clicked"/>
<Button Text="Having Trouble ? connect Manualy"
BackgroundColor="#00D06262"
Margin="0,250,0,0"/>
</StackLayout>
<WebView x:Name="TestWebView"
HeightRequest="100"
WidthRequest="100"/>
</ContentPage>
解决方案
ContentPage 不支持多个项目。考虑将 Web 视图放入 StackLayout 或(如果您需要按钮来覆盖 Web 视图)使用 AbsoluteLayout。
推荐阅读
- drupal - 在使用 Drupal 8 迁移期间如何将我的子组与组关联
- testing - 在 Raku 中测试私有方法
- javascript - 在我的代码中使用 javascript 未在表中显示行
- node.js - 如何在 React 中以 3 行列出项目
- ios - SwiftUI - 如何将自定义类数据保存到 UserDefaults?
- next.js - 应用程序在本地工作但不在生产环境中:TypeError:无法读取未定义的属性“titulo_categoria”
- c - 将字符串插入二维字符数组,然后用 C 中的指针打印它们
- java - 如何使用 BorderLayout 创建可移动的 JPanel?
- android - AdMob 广告横幅显示在导航栏顶部
- html - 悬停不覆盖整个文本