横屏
manifest
中的activity
中配置android:screenOrientation="sensorLandscape"
,sensorLandscape
表示横屏显示,但是会随着用户手机重力,做旋转。
影藏ActionBar
去掉标题栏,titleBar
或者actionBar
是最简单的,通过设置theme
,android:theme="@style/Theme.AppCompat.Light.NoActionBar"
即可取消掉ActionBar这一块的显示。
还有一种方式是在Activity的onCreate方法的setContentView(resId)之前设置影藏requestWindowFeature(Window.FEATURE_NO_TITLE)
。
影藏电池栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
可以直接在APP项目的baseActivity
中进行如下设置:
//去除title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//去掉Activity上面的状态栏
getWindow().setFlags(WindowManager.LayoutPa