Android 如何在WebView中搜索Youtube视频?
我有一个Android应用程序,有两个活动:一个是Youtube Webview,另一个是mainactivity,它从键盘上获取字符串 有没有办法在Youtube上显示我启动Webview活动时搜索到的字符串Android 如何在WebView中搜索Youtube视频?,android,webview,youtube,Android,Webview,Youtube,我有一个Android应用程序,有两个活动:一个是Youtube Webview,另一个是mainactivity,它从键盘上获取字符串 有没有办法在Youtube上显示我启动Webview活动时搜索到的字符串 谢谢是的,您可以在webview中搜索和播放视频 这是youtube的布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/a
谢谢是的,您可以在webview中搜索和播放视频 这是youtube的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView"
android:layout_gravity="center"
/>
<FrameLayout
android:id="@+id/customViewContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
/>
</LinearLayout>
搜索像这样的视频
universalWebViewFragment.searchOnYoutube(searchView
.getText().toString());
别忘了添加权限
<uses-permission android:name="android.permission.INTERNET" />
在这里找到完整的项目
universalWebViewFragment = UniversalWebViewFragment.newInstance();
getFragmentManager().beginTransaction()
.add(R.id.frame_root, universalWebViewFragment).commit();
universalWebViewFragment.searchOnYoutube(searchView
.getText().toString());
<uses-permission android:name="android.permission.INTERNET" />