本文实例讲述了Android编程实现播放视频时切换全屏并隐藏状态栏的方法。分享给大家供大家参考,具体如下:

1.
Demo示例:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
// this.requestWindowFeature(Window.f);// 去掉标题栏
// this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
// WindowManager.LayoutParams.FLAG_FULLSCREEN);// 去掉信息栏
Log.i("info", "portrait"); // 竖屏
}