全屏

在Activity的onCreate方法中的setContentView(myview)调用之前添加下面代码
requestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏标题
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏

  

横屏(两种)

1、修改Activity的onResume方法
@Override
protected void onResume() {
 /**
  * 设置为横屏
  */
	if(getRequestedOrientation()!=ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
	}
	super.onResume();
}

2、在配置文件中对Activity节点添加android:screenOrientation属性(landscape是横向,portrait是纵向)

android:launchMode="singleTask" 
android:screenOrientation="portrait"

  

屏幕常亮:

view.setKeepScreenOn(true)

  


 
                    
            
                

相关文章:

  • 2021-11-11
  • 2021-08-22
  • 2021-12-16
  • 2021-11-21
  • 2021-12-31
  • 2021-12-23
  • 2021-12-23
  • 2021-11-04
猜你喜欢
  • 2021-11-16
  • 2021-08-22
  • 2021-11-15
  • 2021-08-05
  • 2021-11-01
  • 2021-12-05
  • 2018-06-14
  • 2021-11-15
相关资源
相似解决方案