0

How to do or what classes I need to use to show a graphic animation ( which I already developed) on top of any Android application that is currently running or in Android Home screen? A good example of such application is Screen Overlay Decore by devLNX

This app display snowflakes animation on top of any other Android app that is currently active or in Android home screen.

This overlay animation should in no way affect the behavior of the application on which it is showing the animation like screen buttons or touch functions the same way and my animation is non-interactive overlayed on top of the application.

ace
  • 11,526
  • 39
  • 113
  • 193

1 Answers1

2

What you're looking for is called a system overlay window.

There have been many questions about this in the past; perhaps you'll find an answer by looking at these:

It essentially comes down to:

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 view = (ViewGroup) App.inflater.inflate(R.layout.overlay_view, null);
getWindow().setAttributes(params);
wm.addView(view, params);
Community
  • 1
  • 1
Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
  • There is another question with code example that works for me. It already has an animation effect inside http://stackoverflow.com/questions/17745282/windowmanager-with-animation-is-it-possible – Arkady Apr 04 '17 at 10:30