当我们滚动时,YouTube 视频播放器会与其他布局重叠
我正在开发一个应用程序,可以使用 iframe 在 webview 中播放 youtube 视频。 我的代码如下:
String summary = "<iframe height='"
+ displayWidth
+ "' width='"
+ 800
+ "' frameborder='0' src='http://www.youtube.com/embed/ZfekaIW6esA?rel=0'></iframe>";
if (flashInstalled) {
mWebView.loadData(summary, "text/html", null);
container.addView(mWebView);
} else {
alert.setMessage("Flash player is not installed on the device!");
alert.show();
}
它工作正常,但是当我缩放它并滚动它时,它将与其他布局重叠 看看我的屏幕截图
请给我更好的解决方案。谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为你的 Iframe 宽度和高度超过 Webview 宽度和高度。减小 Iframe 的大小。如果您想要更大的尺寸,请增加 webview 的尺寸。
I think your Iframe width and height are more than Webview width and height. Decrease the size of Iframe. If you want a larger size, increase the size of webview.
我希望你是这样问的
下面的代码可能会帮助您,
<?xml version =“1.0”encoding =“utf-8”?>
android:layout_width="fill_parent"
android:id="@+id/imageView1"
android:layout_height="fill_parent"
android:background="#FFF"
android:orientation="vertical" >
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentTop=" true"
android:layout_centerHorizontal="true"
android:src="@drawable/bg" />
android:layout_width="match_parent"
android:layout_above="@+id/imageView"
android:layout_height="fill_parent "
android:layout_below="@+id/imageView1" >
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" >
;ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="@drawable/bg" />
I hope You are asking like this
The Below Code Might Help you,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/bg" />
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_above="@+id/imageView"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView1" >
<!-- Scroll View can Hold only one "Child"
So Create a Dummy Layout if you
have more than 1 child coming
inside Scroll View -->
<!-- Add any Number of Childs -->
<android.webkit.WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" >
</android.webkit.WebView>
<!-- Add any Number of Childs -->
</ScrollView>
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="@drawable/bg" />
</RelativeLayout>