有没有办法将网页显示为标签页?选项卡式页面有2个选项卡。一个用于联系,一个用于联系,是否可以将选项卡式页面的内容设置为“www.example.com/about”或“www.example.com/contact”等网址? 目前我只在选项卡页面上有一个按钮,用于打开浏览器。代码如下:
public AboutPage()
{
InitializeComponent();
this.Title = "About";
StackLayout contact = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
HorizontalTextAlignment=TextAlignment.Center,
Text = "contact here"
}
}
};
var browser = new WebView();
var htmlSource = new HtmlWebViewSource();
htmlSource.BaseUrl = "http://www.google.com";
browser.Source = htmlSource;
Button abtbutton = new Button
{
Text = "View about page"
};
abtbutton.Clicked += OnAboutBtnClicked;
this.Children.Add(new ContentPage
{
Title = "About",
Content = browser
}
);
this.Children.Add(new ContentPage
{
Title = "Contact",
Content = contact
});
}
void OnAboutBtnClicked(object sender, EventArgs args)
{
Device.OpenUri(new Uri("http://www.google.com"));
}