1
如何将视频从YouTube或雅虎视频嵌入到Android应用程序中 我使用的是Phonegap,因此主要是在编写JavaScript,然后将代码包装为本地代码如何将视频从雅虎视频或YouTube嵌入到Android
但我只写JS & HTML5
如何将视频从YouTube或雅虎视频嵌入到Android应用程序中 我使用的是Phonegap,因此主要是在编写JavaScript,然后将代码包装为本地代码如何将视频从雅虎视频或YouTube嵌入到Android
但我只写JS & HTML5
您很可能希望使用WebView与链接的嵌入式视频超链接指向。
大意如下的东西线:
<LinearLayout ... >
... my content
<WebView android:id="@+id/webView1" ... >
...
</WebView>
</LinearLayout>
然后使用下面的钩子代码(大多来自网页视图文档):
WebView webview = (WebView) activity.getViewById(R.id.webView1);
// Simplest usage: note that an exception will NOT be thrown
// if there is an error loading this page (see below).
webview.loadUrl("http://slashdot.org/");
// OR, you can also load from an HTML string:
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
webview.loadData(summary, "text/html", "utf-8");
// ... although note that there are restrictions on what this HTML can do.
// See the JavaDocs for loadData() and loadDataWithBaseURL() for more info.
不要忘记
<uses-permission android:name="android.permission.INTERNET" />
在清单中。