大家好 我在对话框 View 中嵌入视频 View 时遇到问题
一切正常,只是对话框中显示的视频比在 Activity 的其余部分中显示的要暗得多
有什么想法吗?
这里有一些代码
button1main.setOnClickListener(new OnClickListener() {
public VideoView videoView = null;
@Override
public void onClick(View v) {
//set up dialog
Dialog dialog = new Dialog(CustomDialog.this);
dialog.setContentView(R.layout.maindialog);
//dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
this.videoView = (VideoView) dialog.findViewById(R.id.video);
VideoPlayer vp = new VideoPlayer(this.videoView, null);
vp.playVideo();
//set up button
Button button = (Button) dialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//now that the dialog is set up, it's time to show it
dialog.show();
}
});
最佳答案
VideoView 似乎变暗了,因为它是在窗口后面创建的。
Jason Rogers 解决方案有效,但意味着对话框后面的区域不会变暗。
我用过
mVideoView.setZOrderOnTop(true);
将 VideoView 放在前面,这样它就不会变暗,但对话框后面的所有内容仍然会变暗。
关于Android VideoView : Video view is much darker in a dialog view,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5242835/