gpt4 book ai didi

android - 视频 View 以避免或清除 android 中手机屏幕的背景

转载 作者:行者123 更新时间:2023-11-29 14:50:42 26 4
gpt4 key购买 nike

如何在android中使用视频 View 避免或清除手机屏幕的背景?

[1]: ( http://i.stack.imgur.com/0pl9W.png )

View.OnClickListener handleOnClickVideo(final ImageView button1) {
return new View.OnClickListener() {
public void onClick(View v) {
try {

Constant.database = new MyHelper(getApplicationContext());
Constant.sqldb = Constant.database.getReadableDatabase();
imageShowed.setVisibility(View.GONE);
videoShowed.setVisibility(View.VISIBLE);
mVideoView.setBackgroundColor(Color.BLACK);
bar.show();
int newVideoId = button1.getId();
Constant.database.getContentValues(newVideoId);
String getVideo = "https://whootin.s3.amazonaws.com/uploads/upload/21e0b4df-120d-4c9f-ad4a-b475bb844b48/Homemade%20Steak%20Fajitas%20Recipe%20-%20Laura%20Vitale%20-%20Laura%20in%20the%20.mp4?AWSAccessKeyId=AKIAJF5QHW2P5ZLAGVDQ&Signature=EGU5xUP3E8QpkTrG71dr0MvR2hQ%3D&Expires=1381916425";//GetSet.getVideo();
Log.d("video", getVideo);
mVideoView.setSoundEffectsEnabled(true);
mVideoView.setDrawingCacheEnabled(true);
mediaController.setAnchorView(mVideoView);
mVideoView.setVideoURI(Uri.parse(getVideo));
mVideoView.setKeepScreenOn(true);
mVideoView.setMediaController(mediaController);
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(PreparedListener);
Constant.database.close();

} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
bar.dismiss();
}
}
};
}

我附上了我的代码。

最佳答案

您可以在视频开始前将mVideoView 的可见性设置为GONE

public void onPrepared(MediaPlayer mp) {

View placeholder = (View) findViewById(R.id.placeholder);

placeholder.setVisibility(View.GONE);
}

或者你可以像这样改变mVideoViewZOrder

videoView.setZOrderOnTop(true);

引用这个问题:Android VideoView black screen

关于android - 视频 View 以避免或清除 android 中手机屏幕的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19269449/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com