在应用程序内加载 URL
我正在寻找一种在应用程序页面中加载外部网站的方法。
例如,在主屏幕上有一个公司的网站链接,单击时会产生到显示该公司网站的另一个页面的过渡效果,但也允许您包含该页面的页眉和页脚。您还可以包含返回选项或其他链接。
我相信这是可能的,所以对此的任何帮助都会很棒。谢谢,
I am looking for a way to load an external website within a page in the app.
For example have a website link for a company on the main screen and when clicked have the transition effect to another page that displays the company website, but also allows you to include the header and footer for the page. You can also include options to go back, or other links.
I believe this is possible, so any help with this would be great. Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信你正在谈论Android的WebView类。
http://developer.android.com/reference/android/webkit/WebView.html
I believe you are talking about Android's WebView class.
http://developer.android.com/reference/android/webkit/WebView.html
http://developer.android.com/resources/tutorials/views/hello -webview.html
您只需要使用
webview
视图。之后,将视图放置在您想要的任何位置并将其发送到您想要的任何网址就非常简单了。http://developer.android.com/resources/tutorials/views/hello-webview.html
You just need to use the
webview
view. After that it's pretty simple to place the view wherever you want and send it to any url you'd like.我目前正在使用这个方法并且它有效。
不要忘记你的xml文件我的名为html_view,它有一个webview,id为viewHTML,文件看起来像这样:
在课堂活动中最重要的事情(也是大多数人在给出答案时错过的)是将您的 Web 视图设置为 WebClient,否则您的手机将需要在外部浏览器中打开 URL。
I currently am using this method and it works.
don't forget your xml file mine is named html_view it has a webview in it with the id of viewHTML the file looks like this:
in the class activity the important thing to (and what most people miss when giving an answer) is to set your web view as the WebClient otherwise your phone will want to open the url in a external browser.