Kartik Domadiya
Kartik Domadiya

Reputation: 29968

How to display Image on top of every view in android (eg. Like cracked screen app in market)

I want to create something like Better Cracked Screen.

The cracked screen remains top of everything.

I am not able to get how to make such thing which resides top of everything.

Behavior : For example when cracked screen is displayed, and if i press home button then it shows me the home but the cracked screen remains as it is(here on top of home).. doesnot matter whereever you move.. cracked screen appears intact..

Search Results so far : Google API Demos : Translucent GLSurfaceView

Can anyone guide me how can i achieve this task ? Or can anyone please provide me a sample code for this ?

Upvotes: 2

Views: 1888

Answers (2)

Martin Nordholts
Martin Nordholts

Reputation: 10358

Use android.permission.SYSTEM_ALERT_WINDOW.

That will allow you to create a window that is placed on top of all application windows. A key insight to have here is that you can not work on a View level to solve this. A View hierarchy is drawn inside a window, so to place something on top of all windows, you need another window.

Upvotes: 5

banzai86
banzai86

Reputation: 747

I would guess it is an ImageView that is created as the last part of your xml files (meaning it is on top of the stack/ above all other elements). And the Image in this ImageView is mostly transparent so that you see the elements below it

Upvotes: 0

Related Questions