如何保护通知栏?

时间:2013-03-28 17:51:33

标签: android statusbar motionevent

我想根据状态栏检测操作。实际上我想限制本节的权利。我试过了

mGrid.setOnTouchListener(new OnTouchListener(){
               public boolean onTouch(View arg0, MotionEvent arg1){
                    int x = (int) arg1.getX();
                    int y = (int) arg1.getY();
                    Log.d("Screen", String.valueOf(x));
                    Log.d("Screen", String.valueOf(y));
                    switch(arg1.getAction()){
                    case MotionEvent.ACTION_OUTSIDE:
                        Log.d("tototootot", "acces dinied");
                    //case MotionEvent.


                    }


                    return true;
               } 

1 个答案:

答案 0 :(得分:0)

您无法真正检测通知栏上的触摸和事件。

然而,您可以通过覆盖通知栏来阻止所有触摸完全到达它,系统覆盖不会让触摸事件过滤掉。 This所以问题显示了如何绘制叠加层。一旦完成应用程序,请务必将其删除,因为无论哪个应用程序位于前台,它都会一直存在。