Created
December 12, 2020 13:08
-
-
Save mhrpatel12/c019d8baada0c5ebe4c86347251d5ec3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onServiceConnected() { | |
super.onServiceConnected() | |
val wm = getSystemService(WINDOW_SERVICE) as WindowManager | |
val mLayout = FrameLayout(this) | |
val lp = WindowManager.LayoutParams() | |
lp.type = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY | |
lp.format = PixelFormat.TRANSLUCENT | |
lp.flags = lp.flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | |
lp.width = WindowManager.LayoutParams.WRAP_CONTENT | |
lp.height = WindowManager.LayoutParams.WRAP_CONTENT | |
lp.gravity = Gravity.TOP | |
val inflater = LayoutInflater.from(this) | |
inflater.inflate(R.layout.your_layout, mLayout) | |
wm.addView(mLayout, lp) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment