How to generate custom dialog box in android like this,
I want just like this. How to generate it. please give me suggestion.
i have used below code for dialog box, what is the problem in my code? I have not identify it. please share me any Idea.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<RelativeLayout
android:id="@+id/rl_quit_learning"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@drawable/btn_white"
android:paddingBottom="@dimen/thirty_dp"
android:paddingLeft="@dimen/ten_dp"
android:paddingRight="@dimen/ten_dp"
android:paddingTop="@dimen/ten_dp">
<TextView
android:id="@+id/tv_quit_learning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/ten_dp"
android:text="Quit LEarning?"
android:textSize="@dimen/twenty_sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_quit_learning"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/ten_dp"
android:layout_marginRight="@dimen/ten_dp"
android:layout_marginTop="@dimen/twenty_dp"
android:gravity="center"
android:text="You are 400pts. away from \n unlocking rewards. Quit LEarning?"
android:textSize="@dimen/sixteen_sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="125dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
<Button
android:id="@+id/btn_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Video" />
</LinearLayout>
</RelativeLayout>
Please share me any Idea. Thanks.
AlertDIalog.Builder
and inflate your layout, then add him to the class bysetVIew(yourView)
– Moderator