0

My question is about android 4.0+

I have a activity with pernament fullscreen by 2 steps:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WindowManager wm = (WindowManager) getApplicationContext().getSystemService(
            Context.WINDOW_SERVICE);
    getWindow().addFlags(WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY);
    getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

and

@Override
public void onResume() {
    super.onResume();
    View decorView = getWindow().getDecorView();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_IMMERSIVE
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE);

It works fine in all android 4.0+, I also can create any view(for example button) in layout, that can be clicked

WindowManager.LayoutParams params = new WindowManager.LayoutParams();
    params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
    params.format = PixelFormat.RGBA_8888; 
    params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    params.width = 600;
    params.height = 200;

    wm.addView(exitButton, params)

On other click-events I get - Dropping event because there is no touchable window and it was great, but I need to use buttons in ActionBar.

Is there a way to do it m.b with WindowManager or another solution?

P.s.

this.requestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
this.requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

not work and theme also havn't effect.

1 Answers1

0

Have you tried to overlay it using <item name="android:windowActionBarOverlay">true</item>?

From the doc:

To enable overlay mode for the action bar, you need to create a custom theme that extends an existing action bar theme and set the android:windowActionBarOverlay property to true.

For more information about this attribute, read this documentation about Overlaying the Action Bar.

Anggrayudi H
  • 14,977
  • 11
  • 54
  • 87