Answer the question
In order to leave comments, you need to log in
How to draw a timer on top of other applications?
How to make a transparent application that will not respond to input events, but pass them to the application below it? Or should it be done through a service that will draw on top of other applications?
The task is to draw the timer in the foreground, on top of all other applications.
Answer the question
In order to leave comments, you need to log in
Here I love to dig towards the overlay.
Only your application will need an additional permission.)
public class OverlayService extends Service {
@Override
public void onCreate() {
super.onCreate();
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
View overlay = /* Твоя вью сдесь*/;
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
windowManager.addView(overlay , params);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question