打开一个网页在一个Android应用程序 [英] Opening a webpage in an Android App

查看:145
本文介绍了打开一个网页在一个Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么你们/加尔斯建议在打开一个网页的内部应用程序(即小窗口,网页中打开它,但不是Web浏览器)我试着去我的网页上融入我的应用程序方面更多的还是减。感谢:)

I was wondering what you guys/gals would recommend in terms of opening a webpage inside an app (i.e a smaller window with a webpage open in it but not a web browser) Im trying to integrate my webpage into my app more or less. Thanks :)

推荐答案

您是否尝试过使用的的WebView 布局?

Have you tried using the WebView layout?

在你的布局文件:

<?xml version="1.0" encoding="utf-8"?>
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

包括网​​络允许进入你的清单:

Include the INTERNET permission into your manifest:

<uses-permission android:name="android.permission.INTERNET" />

,然后在活动:

And then in your Activity:

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");

这将嵌入一个Web浏览器到应用程序中(而不是打开一个外部浏览器)。

This will embed a web-browser into your application (rather than open an external browser).

这篇关于打开一个网页在一个Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆