【问题标题】:youtube video player overlaps the other layout when we scroll当我们滚动时,youtube 视频播放器与其他布局重叠
【发布时间】:2012-02-16 07:25:12
【问题描述】:

我正在开发一个可以使用 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();
    }

它工作正常,但是当我缩放并滚动它时,它会与其他布局重叠 看看我的截图

请给我更好的解决方案。谢谢

【问题讨论】:

  • 你用的哪个flash player能给我链接和放你的xml布局文件吗?
  • 嗨,Ramesh Sundrasana,我也遇到了同样的问题。你修好了吗?我急需你的帮助。
  • @Ramesh Sudrasana 你能回答this Question

标签: android youtube android-webview


【解决方案1】:

我认为您的 iframe 宽度和高度超过了 Webview 的宽度和高度。减小 iframe 的大小。如果您想要更大的尺寸,请增加 webview 的尺寸。

    <RelativeLayout
        android:id="@+id/titlebarlayout"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:background="@drawable/titlebar2" >

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:background="@drawable/searchmap" >
        </Button>

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="10dp"
            android:background="@drawable/searchmap" >
        </Button>
    </RelativeLayout>

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/titlebarlayout" >

        <RelativeLayout
            android:id="@+id/webviewlayout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <android.webkit.WebView
                android:id="@+id/webView1"
                android:layout_width="fill_parent"
                android:layout_height="280dp" >
            </android.webkit.WebView>

            <TextView
                android:id="@+id/textview1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/webView1"
                android:text="Chasing a target of 237 to record their third win on the trot, India needed nine runs off the last over bowled by Lasith Malinga, but Sri Lanka missed the chance to dismiss Dhoni in the fourth ball of the over when the bowler fluffed a simple run out chance; and the skipper then took three runs off the last delivery to leave Sri Lanka still searching for their first win in the tournament. There was some drama even after the last delivery as the umpires checked if the batsmen had ran one short, but replays showed they hadn&apos;t and the match ended in a tie. As an aside, Malinga had a five ball over in India&apos;s 30th over of the innings, and it is anyone&apos;s guess if the result would have been different had the error been spotted.


India stuck to the rotational policy with Sachin Tendulkar coming in for Virender Sehwag, who had a back spasm; while Irfan Pathan made another comeback as he replaced Zaheer Khan, who had a problem with his right calf. Tendulkar hit two boundaries in his 24-ball 15, but never looked comfortable in the middle, and he was the first Indian batsman to be dismissed when he edged an angled delivery around the off stump from Nuwan Kulasekara to Kumar Sangakkara behind the stumps. Tendulkar&apos;s failure is bound to be blamed on the rotational policy by its detractors, who feel the rhythm of the batsmen is disrupted.
                " >
            </TextView>
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>

【讨论】:

【解决方案2】:

希望你这样问


下面的代码可能会对你有所帮助,


android :layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"
android:orientation="vertical" >
android:id= "@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_centerHorizo​​ntal="true"
android:src="@drawable/bg" />

android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_above ="@+id/imageView"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView1" >




android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height=" match_parent"
android:layout_alignParentTop="true" >




ScrollView>


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" />

【讨论】:

  • 不,亲爱的,它是 webview 并且在 webview 中我使用的是 youtube 视频播放器,所以它使用 iframe 并且 iframe 与顶部栏重叠
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-24
  • 1970-01-01
  • 2021-02-07
  • 2017-04-04
  • 1970-01-01
  • 2021-10-26
相关资源
最近更新 更多