3

我有一个应用程序,它在使用服务实现的主屏幕中放置叠加视图。现在我想隐藏显示时间、电池和移动塔图标的状态/通知栏。我试图隐藏状态栏,WindowManager.LayoutParams.FLAG_FULLSCREEN但它没有做任何事情。查看参数的完整代码在这里:

在 Service 类的 onCreate() 方法中:

@Override
public void onCreate() {

    super.onCreate();
    inflater = LayoutInflater.from(this);
    oView = inflater.inflate(R.layout.main, null);

    gView = (GlowPadView) oView.findViewById(R.id.incomingCallWidget);
    gView.setPointsMultiplier(12);
    oView.setBackgroundColor(0x88ff0000);
    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);

    // oView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                    | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                    | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            PixelFormat.TRANSLUCENT);
    wm.addView(oView, params);
    oView.setOnTouchListener(this);
    gView.setOnTriggerListener(new OnTriggerListener() {

        @Override
        public void onTrigger(View v, int target) {
            // TODO Auto-generated method stub
            if (target == 0) {
                stopSelf();
            }
        }

        @Override
        public void onReleased(View v, int handle) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onGrabbedStateChange(View v, int handle) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onGrabbed(View v, int handle) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onFinishFinalAnimation() {
            // TODO Auto-generated method stub
        }
    });

现在我只想隐藏状态栏..任何帮助将不胜感激............在此先感谢......

4

0 回答 0