我在两天多的时间里试图了解关于EXOPLAYER
的默认播放按钮。但现在被卡住了。
我的问题是,点击时是否可以检测到默认播放按钮?
当默认播放按钮点击时,我需要进行全屏模式。我想直接点击播放。不需要另一个按钮。
defaultPlayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//do the fullscreen mode
}
});
我个人使用这种方法进行强制全屏操作:
public void performFullScreenOperations(Boolean isFullScreen){
if(!isFullScreen) {
//fullscreenButton.setImageDrawable(ContextCompat.getDrawable(MainActivity.this, R.drawable.ic_fullscreen_open));
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
if(getSupportActionBar() != null){
getSupportActionBar().show();
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) playerView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = (int) ( 200 * getApplicationContext().getResources().getDisplayMetrics().density);
playerView.setLayoutParams(params);
//fullscreen = false;
}else{
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
if(getSupportActionBar() != null){
getSupportActionBar().hide();
}
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) playerView.getLayoutParams();
params.width = params.MATCH_PARENT;
params.height = params.MATCH_PARENT;
playerView.setLayoutParams(params);
//fullscreen = true;
}
}