本帖最后由 dengliren 于 2013-11-05 16:12:42 编辑

解决方案 »

  1.   

    这是4.3的,属性你和2.3作个对比
            if (mKeyguardHost == null) {
                if (DEBUG) Log.d(TAG, "keyguard host is null, creating it...");            mKeyguardHost = new ViewManagerHost(mContext);            int flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                        | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
                        | WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
                        | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;            if (!mNeedsInput) {
                    flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
                }
                if (ActivityManager.isHighEndGfx()) {
                    flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
                }            final int stretch = ViewGroup.LayoutParams.MATCH_PARENT;
                final int type = isActivity ? WindowManager.LayoutParams.TYPE_APPLICATION
                        : WindowManager.LayoutParams.TYPE_KEYGUARD;
                WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
                        stretch, stretch, type, flags, PixelFormat.TRANSLUCENT);
                lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
                lp.windowAnimations = com.android.internal.R.style.Animation_LockScreen;
                lp.screenOrientation = enableScreenRotation ?
                        ActivityInfo.SCREEN_ORIENTATION_USER : ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;            if (ActivityManager.isHighEndGfx()) {
                    lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
                    lp.privateFlags |=
                            WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED;
                }
                lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY;
                if (isActivity) {
                    lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
                }
                lp.inputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_DISABLE_USER_ACTIVITY;
                lp.setTitle(isActivity ? "KeyguardMock" : "Keyguard");
                mWindowLayoutParams = lp;
                mViewManager.addView(mKeyguardHost, lp);
            }