Add View to android rootView application without permission
Asked Answered
A

0

0

I want to add an overlay to the application rootView or BaseActivity without permission.

And it should be displayed on top of BottomSheetDialog or on top of Copy Cut Paste ContextMenu in EditText

I have tried multiple ways but didn't successed.

        val rootLayout = findViewById(android.R.id.content) as ViewGroup

        val viewToAdd = View.inflate(this,R.layout.fragment_maintenance,rootLayout)
        ///val viewToAdd = layoutInflater.inflate(R.layout.fragment_maintenance,null)
        val params = ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT
        )
        viewToAdd.layoutParams = params
        ///params.gravity = Gravity.BOTTOM or Gravity.CENTER
        ///rootLayout.addView(viewToAdd)
        ///val rootLayout = window.decorView.rootView
        //val rootLayout = window.decorView.findViewById<ViewGroup>(android.R.id.content)
        ///View.inflate(this, R.layout.fragment_maintenance, rootLayout)

And can we add any view using WindowManager without permission.

Ankylose answered 22/6, 2023 at 8:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.