Android视频链接显示在android textview中,就像我们使用html.imageGetter显示图像一样

时间:2016-05-24 18:44:45

标签: android html video iframe

我们可以在TextView中显示来自html内容的视频吗?我在我的一个Texview中显示html内容,通过实现Html.ImageGetter实现显示图像,但不知道显示视频,

我的Html内容是这样的:

    <p>Police today baton charged hundreds of daily wagers working in                   various government departments during a protest here in which they were demanding regularisation of service.</p>
    <p>The workers assembled at Sher-e-Kashmir Park and started marching towards Lal Chowk area of the city raising slogans in favour of their demands, a police official said.</p>
    <p>He said as soon as the protesters crossed the Polo View crossing, police intercepted them and asked the protesters to disperse peacefully.</p>
   <p>However, they refused to pay any heed and tried to march ahead.</p>
   <p>The police used batons to disperse the protesters and took over 30 of them into preventive custody, the official said.</p>
   <p>No one was injured in the police action, he added.</p>
   <p><iframe width="480" height="315"   src="http video link url" frameborder="0" allowfullscreen="">   </iframe></p>

在内容结束时,我在iframe中有视频,我无法显示,我们可以在Android中实现这一点吗? 请建议。

2 个答案:

答案 0 :(得分:1)

  

我们可以在TextView

中显示来自html内容的视频吗?

不,抱歉,TextView无法显示视频。

  

我们可以在android中实现这个吗?

使用WebView

答案 1 :(得分:1)

您也可以从iframe创建链接。

htmlString.replaceAll("<iframe\\s+.*?\\s+src=(\".*?\").*?<\\/iframe>", "<a href=$1>CLICK TO WATCH</a>");

此处还有: TagHandler to handle Youtube tag ?