enter image description hereI想提出一个应用程序,只需申请使用按钮链接,我想在这是行不通的网页视图显示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。
内容页只能有一个直接子让你的XAML代码应该是这样的:
<?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"/>
<WebView x:Name="TestWebView"
HeightRequest="100"
WidthRequest="100"/>
</StackLayout>
</ContentPage>