在Android上的视频上添加叠加 [英] Add overlays to video on Android
问题描述
我正在开发一个Android应用程序,此应用程序从android画廊加载保存在SD卡上的视频文件.
我需要知道如何将叠加层添加到该视频
我需要在此视频中添加标题和图像,例如品牌图像
I'm developing an Android application, this application load video file from android gallery that saved on SD Card.
I need to know how can I add overlays to this video
I need to add title and image on this video like brand images
我找不到描述如何执行此操作的示例或教程
I can not find an example or tutorial describe how to do this operation
我必须使用解码来添加叠加层吗? ,如果可以,我该怎么做.
关于此的任何示例...
Any example about this...
推荐答案
如果您正在使用VideoView
或类似格式播放视频,则可以使用View
(例如TextView
,ImageView
)覆盖任何View
RelativeLayout
.
例如,要在视频的右上角显示文本:
Provided you're playing the video using a VideoView
or similar, you can overlay any View
(e.g. TextView
, ImageView
) using a RelativeLayout
.
For example, to show a text on the top right corner of the video:
<RelativeLayout
android:id="@+id/playerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<VideoView
android:id="@+id/videoPlayer"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/videoText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="3dp"
android:text="@string/player_text" />
</RelativeLayout>
这篇关于在Android上的视频上添加叠加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!