A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

JavaFile name : – CustomDiolog.java

package com.jeevan.karan.custom_diolog;
import android.app.Dialog;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import comjeevan.karan.R;
public class CustomDiolog extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_diolog);
Dialog dialog = new Dialog(CustomDiolog.this);
dialog.setContentView(R.layout.diolog_pro);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
Window dialogWindow = dialog.getWindow();
dialogWindow.setGravity(Gravity.CENTER);
dialog.show();
}
}

Xml File: – diolog_pro.xml

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical” android:layout_width=”match_parent”
android:layout_height=”match_parent”>
<RelativeLayout
android:layout_width=”300dp”
android:layout_height=”150dp”
android:orientation=”vertical”
android:padding=”12dp”
android:background=”#ef4242″
>
<TextView
android:id=”@+id/profile”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:textSize=”18dp”
android:paddingBottom=”4dp”
android:paddingTop=”4dp”
android:paddingLeft=”16dp”
android:paddingRight=”16dp”
android:background=”@drawable/design1″
android:layout_marginTop=”20dp”
android:textColor=”#ffffff”
android:gravity=”center”
android:text=”Are you happy taday” />
<TextView
android:id=”@+id/setting”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginTop=”16dp”
android:textSize=”18dp”
android:paddingBottom=”4dp”
android:paddingTop=”4dp”
android:paddingLeft=”16dp”
android:paddingRight=”16dp”
android:background=”@drawable/design”
android:layout_alignParentBottom=”true”
android:textColor=”#ffffff”
android:text=”Yes” />
<TextView
android:id=”@+id/logout”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_marginTop=”16dp”
android:paddingBottom=”4dp”
android:paddingTop=”4dp”
android:paddingLeft=”16dp”
android:paddingRight=”16dp”
android:background=”@drawable/design”
android:layout_alignParentRight=”true”
android:layout_alignParentBottom=”true”
android:textSize=”18dp”
android:textColor=”#ffffff”
android:text=”No” />
</RelativeLayout>
</LinearLayout>

For Drawable designs: – See this Example