在程序中可以通过对Android:screenOrientation
的值设置的不同来控制显示,通常在Androidmainfest中修改,将其设置为activity中;如下所示
<activity
android:name="com.shzx.yyqg.ui.activity.MainActivity"
android:screenOrientation="portrait"//设置为只能竖屏显示
android:theme="@android:style/Theme.Black.NoTitleBar" >//隐藏标题栏
</activity>
Android:screenOrientation可以设为以下属性值
unspecified默认值
landscape横向
portrait纵向
user用户当前的首选方向
behind根据用户的旋转和手持设备方向来更改显示方向
nosensor不根据用户的旋转和手持设备方向来更改显示方向