有没有办法将网页显示为标签页?选项卡式页面有 2 个选项卡。一个关于,一个联系,是否可以将标签页的内容作为“www.example.com/about”或“www.example.com/contact”之类的url?目前,我在标签页上只有一个按钮,可以打开浏览器。下面的代码:
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"));
}