4
我有一个android应用程序,它显示带有按钮的VideoView。在目标设备上,按钮正确显示在顶部,直到VideoView重新绘制(例如从另一个活动返回时)。然后按钮被VideoView隐藏。如何强制在视频上进行alpha混合
这不会发生在其他两个设备上,并且据我所知,这不是Android中的预期行为。我相信它与我在设备上看到的错误有关。标签是'TIOverlay'
和文字
'static void overlay_control_context_t::overlay_destroyOverlay(overlay_control_device_t*, overlay_t*) : Lets Switch off Alpha Blending'
有没有方法来强制VideoView重新计算它的阿尔法?由于初始视图是正确的,我认为它只是在重绘时没有考虑完整的布局。
这是我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>
“我有一个android应用程序,它显示一个带有按钮的VideoView” - 你是怎么做到的? – CommonsWare 2012-03-10 00:28:47
不错的问题和答案,杰森!投了票。既然你已经回答了你自己的问题,建议你把它作为一个单独的“答案”发布,这样你就可以得到好评。完美合法的Stackoverflow行为;甚至有一个回答你自己的问题的徽章! – 2013-03-09 00:41:46