title: How show cardview as a dilouge while bluring the background
body: <p>I have a card view with 2 radio buttons I want to show it as a dialogue</p>
  <p>I want to achieve multiple things</p>
  <ol>
  <li>Showing card view as a dialogue</li>
  <li>blurring the background layout while showing the dialog</li>
  <li>I have 2 radio buttons (only one is selectable) I want that after selecting one of them the dialogue will disappear but not immediately at least there should be a short delay so the user can see the selection of the radio button</li>
  </ol>
  <blockquote>
  <p>Note:- If you want more references of the code please tell me I will
  update the question as you can find I dint include the fragment_home
  java file so the question doesn't get long and confusing</p>
  </blockquote>
  <p>Here is the layout</p>
  <p><strong>sort_image.xml</strong></p>
  <pre><code>&lt;com.google.android.material.card.MaterialCardView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      android:layout_width=&quot;300dp&quot;
      android:layout_height=&quot;200dp&quot;
      android:layout_gravity=&quot;center&quot;
      android:backgroundTint=&quot;@color/grey&quot;
      app:cardCornerRadius=&quot;20dp&quot;&gt;
  
      &lt;RelativeLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/sort_textView&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_alignParentTop=&quot;true&quot;
              android:layout_centerInParent=&quot;true&quot;
              android:layout_marginTop=&quot;5dp&quot;
              android:fontFamily=&quot;@font/roboto&quot;
              android:text=&quot;Sort by&quot;
              android:textAlignment=&quot;center&quot;
              android:textColor=&quot;@color/lite_grey&quot;
              android:textSize=&quot;25sp&quot; /&gt;
  
          &lt;com.google.android.material.card.MaterialCardView
              android:id=&quot;@+id/divider_line_sort_by&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;1dp&quot;
              android:layout_below=&quot;@id/sort_textView&quot;
              android:layout_marginStart=&quot;10dp&quot;
              android:layout_marginTop=&quot;5dp&quot;
              android:layout_marginEnd=&quot;10dp&quot;
              android:backgroundTint=&quot;@color/lite_grey&quot;
              app:cardCornerRadius=&quot;50dp&quot; /&gt;
  
          &lt;RelativeLayout
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_centerInParent=&quot;true&quot;&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/latest_sort_textView&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_marginStart=&quot;30dp&quot;
                  android:layout_marginTop=&quot;30dp&quot;
                  android:fontFamily=&quot;@font/roboto&quot;
                  android:text=&quot;Latest&quot;
                  android:textAlignment=&quot;center&quot;
                  android:textColor=&quot;@color/lite_grey&quot;
                  android:textSize=&quot;25sp&quot; /&gt;
  
              &lt;TextView
                  android:id=&quot;@+id/most_popular_sort_textView&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_below=&quot;@+id/latest_sort_textView&quot;
                  android:layout_alignParentStart=&quot;true&quot;
                  android:layout_centerInParent=&quot;true&quot;
                  android:layout_marginStart=&quot;30dp&quot;
                  android:layout_marginTop=&quot;25sp&quot;
                  android:fontFamily=&quot;@font/roboto&quot;
                  android:text=&quot;Most Popular&quot;
                  android:textAlignment=&quot;center&quot;
                  android:textColor=&quot;@color/lite_grey&quot;
                  android:textSize=&quot;25sp&quot; /&gt;
  
              &lt;RadioGroup
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_alignParentEnd=&quot;true&quot;&gt;
  
                  &lt;RadioButton
                      android:id=&quot;@+id/latest_sort_radio_button&quot;
                      android:layout_width=&quot;wrap_content&quot;
                      android:layout_height=&quot;wrap_content&quot;
                      android:layout_marginTop=&quot;25sp&quot; /&gt;
  
                  &lt;RadioButton
                      android:id=&quot;@+id/most_popular_sort_radio_button&quot;
                      android:layout_width=&quot;wrap_content&quot;
                      android:layout_height=&quot;wrap_content&quot;
                      android:layout_marginTop=&quot;10dp&quot; /&gt;
  
              &lt;/RadioGroup&gt;
  
          &lt;/RelativeLayout&gt;
  
  
      &lt;/RelativeLayout&gt;
  
  &lt;/com.google.android.material.card.MaterialCardView&gt;
  </code></pre>
  <p><strong>fragment_home.xml</strong> // This layout  contains the text which I want that when pressed I open the dialogue and also this is the fragment/layout which I want to blur when showing the dialogue</p>
  <blockquote>
  <p>Note:- only included the necessary code of this layout</p>
  </blockquote>
  <pre><code>&lt;com.google.android.material.card.MaterialCardView
                  android:id=&quot;@+id/sort&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_centerInParent=&quot;true&quot;
                  android:layout_marginEnd=&quot;5dp&quot;
                  android:layout_marginBottom=&quot;5dp&quot;
                  android:layout_toStartOf=&quot;@id/divider_line&quot;
                  android:backgroundTint=&quot;@color/black&quot;
                  android:elevation=&quot;6dp&quot;
                  android:paddingBottom=&quot;10dp&quot;
                  android:textAlignment=&quot;center&quot;
                  app:cardCornerRadius=&quot;10dp&quot;&gt;
  
                  &lt;TextView
                      android:id=&quot;@+id/sort_text&quot;
                      android:layout_width=&quot;wrap_content&quot;
                      android:layout_height=&quot;wrap_content&quot;
                      android:layout_marginStart=&quot;8dp&quot;
                      android:layout_marginEnd=&quot;8dp&quot;
                      android:layout_marginBottom=&quot;5dp&quot;
                      android:fontFamily=&quot;@font/roboto&quot;
                      android:text=&quot;@string/sort&quot;
                      android:textAlignment=&quot;center&quot;
                      android:textColor=&quot;@color/white&quot;
                      android:textSize=&quot;17sp&quot;
                      android:textStyle=&quot;bold&quot; /&gt;
  
              &lt;/com.google.android.material.card.MaterialCardView&gt;
  </code></pre>