有什么办法让Android播放带有透明区域的视频吗?当我尝试在 VideoView 中播放包含透明区域的 WebM 视频时,视图的背景保持黑色。我希望看到透明区域上显示的父视图的背景,而不是黑色。
到目前为止,我发现的唯一可行的解决方案是从视频帧中创建可绘制的动画,这不太节省内存。
我认为这会解决你的问题
尝试这个https://github.com/pavelsemak/alpha-movie https://github.com/pavelsemak/alpha-movie
这是演示示例,
<RelativeLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/bg1" />
<com.alphamovie.lib.AlphaMovieView
android:id="@+id/alpha_video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
app:accuracy="0.7"
app:alphaColor="#000000"/>
</RelativeLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)