Skip to content

Instantly share code, notes, and snippets.

@Kozlov-V
Created February 24, 2015 18:00
Show Gist options
  • Save Kozlov-V/4e91659eb0110c309b0e to your computer and use it in GitHub Desktop.
Save Kozlov-V/4e91659eb0110c309b0e to your computer and use it in GitHub Desktop.
To create always-top fullscreen overlay activity in Android
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getApplicationContext()
.getSystemService(Context.WINDOW_SERVICE);
ViewGroup mTopView = (ViewGroup) App.inflater.inflate(R.layout.main, null);
getWindow().setAttributes(params);
wm.addView(mTopView, params);
@SanioLukeIDE
Copy link

Thank you. You code thanked me a lot. I have been searching for this code for last 4 days and i was at the edge of giving hope. Thank you so much

@Kozlov-V
Copy link
Author

Kozlov-V commented Oct 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment