簡體   English   中英

在Android中禁用快速設置圖塊

[英]Disable quick settings tile in Android

我找不到在我們的企業啟動器中以編程方式禁用Android中快速設置磁貼的方法。

除了在Android中如何禁用通知欄下拉菜單之外,還有其他線索嗎? https://e2e.ti.com/support/embedded/android/f/509/t/283260

有可能嗎? 謝謝!

在此處輸入圖片說明

您可以在全屏模式下啟動應用程序嗎? 就像這里解釋的那樣: https : //stackoverflow.com/a/8470893/2801860

<activity
  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
  ....
>

是的,你可以做到。 我使用以下代碼段禁用了快速設置。

public static void preventStatusBarExpansion(Context context) {
        WindowManager manager = ((WindowManager) context.getApplicationContext()
                .getSystemService(Context.WINDOW_SERVICE));



        Activity activity = (Activity)context;
        WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
        localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
        localLayoutParams.gravity = Gravity.TOP;
        localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|

                // this is to enable the notification to recieve touch events
                WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |

                // Draws over status bar
                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;

        localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
        int resId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android");
        int result = 0;
        if (resId > 0) {
            result = activity.getResources().getDimensionPixelSize(resId);
        }

        localLayoutParams.height = result;

        localLayoutParams.format = PixelFormat.TRANSPARENT;

        customViewGroup view = new customViewGroup(context);

        manager.addView(view, localLayoutParams);
    }

在任何需要的地方調用此方法。 在調用此方法之前,請確保您具有屏幕覆蓋權限。 但是,在Oreo中不贊成使用此權限。

似乎根本不可能做。

那就是答案。

不,不是不可能。 使用ACTION_CLOSE_SYSTEM_DIALOGS防止在鎖定屏幕時將其拉下。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM