Android 如何在视频视图上强制alpha混合
我有一个android应用程序,它显示一个视频视图,前面有按钮。在目标设备上,按钮正确地显示在顶部,直到VideoView重新绘制自身(例如,当从另一个活动返回时)。然后按钮被VideoView隐藏 这在另外两台设备上是不会发生的,据我所知,这在Android中是不可能发生的。我相信这与我看到设备上抛出的错误有关。标签是Android 如何在视频视图上强制alpha混合,android,video,overlay,Android,Video,Overlay,我有一个android应用程序,它显示一个视频视图,前面有按钮。在目标设备上,按钮正确地显示在顶部,直到VideoView重新绘制自身(例如,当从另一个活动返回时)。然后按钮被VideoView隐藏 这在另外两台设备上是不会发生的,据我所知,这在Android中是不可能发生的。我相信这与我看到设备上抛出的错误有关。标签是'TIOverlay',文本是 'static void overlay_control_context_t::overlay_destroyOverlay( overlay_c
'TIOverlay'
,文本是
'static void overlay_control_context_t::overlay_destroyOverlay( overlay_control_device_t*, overlay_t*) : Lets Switch off Alpha Blending'
是否有任何方法强制VideoView重新计算其alpha值?由于初始视图是正确的,我假设它只是在重画时没有考虑完整的布局
这是我的VideoView初始化代码:
//set up video
this.videoView = (VideoView) findViewById(R.id.introVideoView);
videoView.setZOrderOnTop(false);
//create intro movie and begin playing
String uri = "android.resource://"+getPackageName()+"/"+R.raw.movie;
videoView.setVideoURI(Uri.parse(uri));
//set to looping
videoView.setOnPreparedListener(new OnPreparedListener(){
@Override
public void onPrepared(MediaPlayer mp)
{
mp.setLooping(true);
}});
videoView.start();
编辑
我用来在视频视图前面显示按钮的布局是:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mainLayout" >
<VideoView
android:id="@+id/introVideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ImageButton
android:id="@+id/exitDemoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:contentDescription="Exit Demo >>"
android:onClick="exitDemo"
android:background="#00000000"
android:src="@drawable/exit_selector" />
<LinearLayout
android:id="@+id/buttonLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/resumeVideoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onResumeClicked"
android:contentDescription="Resume Video"
android:background="#00000000"
android:src="@drawable/resume_selector" />
<ImageButton
android:id="@+id/guidedTourButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onTourClicked"
android:contentDescription="Guided Tour"
android:background="#00000000"
android:src="@drawable/tour_selector" />
</LinearLayout>
我确实找到了解决办法。这似乎是因为我正在从具有类似视频视图的其他意图切换回此视图,在切换到其他意图或从该意图切换回此意图之前,我需要使用VideoView.suspend()
挂起视频。我推测这是因为硬件只有一个好的硬件视频缓冲区,它保留了我刚刚离开的视频视图
。“我有一个android应用程序,它显示一个视频视图,前面有按钮”--你怎么做到的?问得好,回答得好,Jason!投票赞成。既然你已经回答了自己的问题,建议你把它作为一个单独的“答案”帖子发布,这样你就可以获得学分。完全合法的堆栈溢出行为;甚至还有一个徽章可以回答你自己的问题!