最近,我正在进行android开发,有一个问题总是困扰我很长一段时间。我想在GLSurfaceView上显示VideoView,我的代码如下:
setContentView(glSurfaceView,new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
videoView= View.inflate(QCARSampleActivity.this, R.layout.main, null);
addContentView(videoView, new LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
mVideoView = (VideoView) overlayView.findViewById(R.id.mVideoView);
播放视频的代码如下:
videoView.setVisibility(View.VISIBLE);
mVideoView.setVisibility(View.VISIBLE);
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.start();
当我运行它时,它工作正常,但只听到声音,看不到视频,为什么?请?
答案 0 :(得分:3)
试试这个:
mVideoView.setZOrderOnTop( true );