'How to make a coachmark that can fill the screen 100%?

I need a coachmark that can follow size as an activity. But the coachmark dialog that I made is always blocked by the bar at the top of the screen. How do I get my dialog to cover the screen up to 100%? Here's what i mean : my coachmark cant fit this screen 100%

Here's my kotlin's code :

private fun dialogCoachMark(
        activity: OnBoardingOneActivity
    ) {
        val dialog = activity.let { Dialog(it) }

        dialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
        dialog?.setCancelable(false)

        val bindingCoachmark: Coachmark by lazy {
            Coachmark.inflate(activity.layoutInflater)
        }
        dialog?.setContentView(bindingCoachmark.root)

        with(bindingCoachmark) {
            lyItemDialogWelcome.btnCloseCoachmark.setOnClickListener {
                dialog?.dismiss()
            }
        }

        dialog?.show()

        val window: Window? = dialog?.window


        window?.setLayout(
            RelativeLayout.LayoutParams.MATCH_PARENT,
            RelativeLayout.LayoutParams.MATCH_PARENT
        )
        window?.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)

        dialog?.window?.setBackgroundDrawable(
            ColorDrawable(Color.TRANSPARENT)
        )
    }

Here's my xml :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:ignore="MissingDefaultResource">

    <id.co.mobile.android.uat.component.ToolbarSubFeatures
        android:id="@+id/toolbar"
        android:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />

    

</RelativeLayout>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source