当前位置:编程学习 > wap >>

android 4.1默认横屏变竖屏的问题

开发的平板,屏幕默认是横的,现在要软件改成竖屏显示的。
增加了ro.sf.hwrotation= 90 ,确实竖过来了。
但是在launcher界面里面进入一个强制横屏的应用时,会先把launcher界面横着显示过来,并且显示的比例也不对,然后才能旋转一下进入应用。看了快2天了,不知道有没有高人遇到过,指点一下,不甚感激 Android 界面 --------------------编程问答-------------------- 楼主,我也遇到这个问题了,后来你是否如何解决的? --------------------编程问答-------------------- 如果想开机就竖直屏幕的话,可以这么在AndroidManifest.xml之中设置为竖的
        <activity
                android:name="Home"
                android:label="@string/app_name"
                android:theme="@style/NoTitle"
                android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity> --------------------编程问答-------------------- 我修改的是系统源码,不是这个配置参数,也是有缺陷的
就是在开机的时候,先2~3秒横屏,然后才竖屏,有一点点的小遗憾(下面是4.0的修改方法)

   android4.0/frameworks/base/services/java/com/android/server/wm/WindowManagerService.java

    int computeForcedAppOrientationLocked() {
        int req = getOrientationFromWindowsLocked();
        if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
            req = getOrientationFromAppTokensLocked();
        }

        // req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; //强制横屏0度

    // req = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; //强制竖屏左转90度

        return req;
    } --------------------编程问答--------------------
引用 2 楼 fighter0593 的回复:
如果想开机就竖直屏幕的话,可以这么在AndroidManifest.xml之中设置为竖的
        <activity
                android:name="Home"
                android:label="@string/app_name"
                android:theme="@style/NoTitle"
                android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

正解
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,