首页 > 移动平台 > 详细

android 横竖屏切换属性

时间:2015-03-03 11:44:51      阅读:340      评论:0      收藏:0      [点我收藏+]

最近在做平板项目,需要用到横屏切换,现在把属性贴出来方便以后查看。

通常我们的应用只会设计成横屏或者竖屏,锁定横屏或竖屏的方法是在manifest.xml文件中设定属性android:screenOrientation为”landscape”或”portrait”:

    <activity
        android:name="com.jooylife.jimei_tablet.base.Main"
        android:label="@string/app_name" 
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

其实screenOrientation还可以设置成很多值:

android:screenOrientation=
["unspecified" | "behind" |"landscape" |   "portrait"|"reverseLandscape"|"reversePortrait" |"sensorLandscape" | "sensorPortrait" |"userLandscape" | "userPortrait" |"sensor" | "fullSensor" | "nosensor" |"user" | "fullUser" | "locked"]

其中sensorLandscape就是横屏根据重力切换,sensorPortrait竖屏根据重力切换。

android 横竖屏切换属性

原文:http://blog.csdn.net/u013895206/article/details/44035091

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!