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

标签 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 中实现这一点吗? 请提出建议。

最佳答案

您还可以从 iframe 创建链接。

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

也在这里发帖: TagHandler to handle Youtube tag ?

关于Android 视频链接显示在 android textview 中,就像我们使用 html.imageGetter 显示图像一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37421528/

相关文章:

video - 从移动网站直接开始youtube视频播放

android - 删除在开发 Android 中安装新版本应用程序时的共享首选项

java - 如何为 ListView 中的最后一项添加颜色 - Android?

Javascript 淡入淡出不工作

android - 为 exoplayer 启用缓存

html - 使用 HTML5 视频标签插入/播放本地视频路径文件

java - 我们应该为 OnClickListeners 或内部命名类使用匿名类吗?

android - 自动发送 whatsapp 消息

jquery - 移动进度条

css - 有没有办法让 float 的 div 标签采用它从内容中获得的实际高度