在开发android的应用中,有时候需要限制横竖屏切换。只需要在AndroidManifest.xml文件中加入android:screenOrientation属性限制。

  1. android:screenOrientation="landscape"是限制此页面横屏显示,
  2. android:screenOrientation="portrait"是限制此页面数竖屏显示。
[html] view plain copy
  1. android:screenOrientation="landscape"是限制此页面横屏显示,
  2. android:screenOrientation="portrait"是限制此页面数竖屏显示。



如果要使Activity的View界面全屏,只需要将最上面的信号栏和Activity的Title栏隐藏掉即可,隐藏Title栏的代码:

requestWindowFeature(Window.FEATURE_NO_TITLE);
  1. 配置文件里代码:
  2. android:theme="@android:style/Theme.NoTitleBar"
  3. 隐藏信号栏的代码:
  4. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  5. 其它使用:
  6. getWindow().setFlags(WindowManager.LayoutParams.TYPE_STATUS_BAR,WindowManager.LayoutParams.TYPE_STATUS_BAR);

更多相关文章

  1. EditText 不显示光标 光标消失
  2. ImageView的scaletype属性
  3. android 状态栏 时间 错误 adb连接
  4. 禁止手机横竖屏
  5. Android全屏显示的两种方式
  6. Android(安卓)中文 API (36) —— Toast
  7. Android(安卓)mvvm使用实战
  8. android 5.1 添加reboot 飞行模式 silent
  9. android tab上显示数字(转)

随机推荐

  1. (学习笔记) Android   Activity相关
  2. Android窗口机制(二)Window,PhoneWindow,Deco
  3. Android:Picker(DatePicker、TimerPicker、
  4. Android imageView ScaleType.FIT_CENTER
  5. [Android]android源码下载&Eclipse关联an
  6. Android可缩放矢量图形(SVG)
  7. android开发每日汇总【2011-12-6】
  8. Android短信的发送和广播接收者实现短信
  9. android webview开发html5
  10. Android之Activity透明背景