override fun onCreate() {
super.onCreate()
windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
binding = ActivityLockBinding.inflate(LayoutInflater.from(this))
lockView = binding.root
val params = WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT
)
windowManager.addView(lockView, params)
}
I popped up activity_lock.xml with the code above. However, the form of the button I set in activity_lock.xml doesn’t apply, and a default button of grey rectangles is created as shown below. Why? Any help would be greatly appreciated.
enter image description here
I’m looking forward to the form being applied normally.
New contributor
정jeong is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.