Skip to content

Instantly share code, notes, and snippets.

@haseebpvt
Created May 27, 2019 15:13
Show Gist options
  • Select an option

  • Save haseebpvt/42328cd3cab6b0421e47bcc1e95b49a9 to your computer and use it in GitHub Desktop.

Select an option

Save haseebpvt/42328cd3cab6b0421e47bcc1e95b49a9 to your computer and use it in GitHub Desktop.
XML Layout for material dialog fragment in android
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minWidth="280dp"
app:cardCornerRadius="20dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="280dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:minWidth="280dp">
<ImageView
android:id="@+id/backgroundImageView"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#181818"/>
<TextView
android:id="@+id/titleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title Here"
android:textSize="24sp"
android:textColor="#181818"
android:textAlignment="center"
android:textStyle="bold"
android:padding="10dp"/>
<TextView
android:id="@+id/descriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Description comes here."
android:textSize="16sp"
android:textColor="#474747"
android:textAlignment="center"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:paddingBottom="10dp"/>
<TextView
android:id="@+id/activateButton"
android:layout_width="100dp"
android:layout_height="50dp"
android:text="ACTIVATE"
android:textSize="16dp"
android:textColor="#FFFFFF"
android:background="#181818"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="50dp"/>
</LinearLayout>
<TextView
android:id="@+id/closeTextView"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="X"
android:gravity="center"
android:textColor="#80F2F2F2"
android:textSize="24sp"
android:layout_gravity="right"
android:layout_margin="20dp"/>
</FrameLayout>
</androidx.cardview.widget.CardView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment