zoukankan      html  css  js  c++  java
  • SystemUI中设置横竖屏显示

    SystemUI中快捷菜单有 “方向锁定” 。

    RotationLockTile

      protected void handleClick() {
            if (mController == null) return;
            MetricsLogger.action(mContext, getMetricsCategory(), !mState.value);
            final boolean newState = !mState.value;
            mController.setRotationLocked(!newState);//这里执行方向锁定
            refreshState(newState);
        }
    

    RotationLockControllerImpl

      public void setRotationLocked(boolean locked) {
            RotationPolicy.setRotationLock(mContext, locked);//执行方向锁定
        }
    

    这个快捷菜单只能在手机已经显示横屏或竖屏后,才能执行,无法预设锁定方向。

    2,StatusBarWindowManager中设置锁屏横屏显示。 

    private void adjustScreenOrientation(State state) {
    
            if (state.isKeyguardShowingAndNotOccluded()) {
    //注释掉源码中对方向的处理 // if (mKeyguardScreenRotation) { // mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER; // } else { // mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; // } mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; //指定锁屏模式下,固定横屏显示。 } else { mLpChanged.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; } }

      

  • 相关阅读:
    HTML Style Sheet
    Chrome 崩溃 相关
    android dialog 不变暗
    URL replacement
    android SharedPreferences
    android PreferenceActivity
    据说还可以的网站
    android brightness control
    Android network status 3G/WIFI
    android activity onSearchRequested()
  • 原文地址:https://www.cnblogs.com/antoon/p/7155357.html
Copyright © 2011-2022 走看看