I have an Android app that displays a VideoView with buttons in front of it. On the target device, buttons are displayed on top until the VideoView overlaps itself (for example, when returning from another activity). Then the buttons are hidden from the VideoView.
This does not happen on the other two devices, and as far as I can tell, this is not expected on Android. I believe that this is due to the error that I see on the device. 'TIOverlay' tag and text
'static void overlay_control_context_t::overlay_destroyOverlay( overlay_control_device_t*, overlay_t*) : Lets Switch off Alpha Blending'
Is there a way to get VideoView to recalculate alpha? Since the original view is correct, I assume that it simply does not account for the full layout when redrawing.
This is my VideoView initialization code:
//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();
Edit
The layout that I use to display buttons before presenting a video:
<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>
Code>
source share