有什么办法可以让安卓播放带透明区域的视频吗?当我尝试在 VideoView 中播放包含透明区域的 WebM 视频时, View 的背景仍然是黑色。我希望看到父 View 的背景显示在透明区域上,而不是黑色。
目前我发现的唯一可行的解决方案是从视频帧中创建一个可绘制的动画,这不是很节省内存。
最佳答案
我认为这会解决你的问题 试试这个 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>
关于android - Android 上的透明视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27319821/