add close button on right top corner of alert dialog box for android

Solutions on MaxInterview for add close button on right top corner of alert dialog box for android by the best coders in the world

showing results for - "add close button on right top corner of alert dialog box for android"
Gianluca
28 Aug 2020
1<?xml version="1.0" encoding="utf-8"?>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3    android:layout_width="match_parent"
4    android:layout_height="wrap_content">
5
6    <RelativeLayout
7        android:layout_width="match_parent"
8        android:layout_height="400dp"
9        android:layout_alignParentTop="true"
10        android:layout_marginLeft="10dp"
11        android:layout_marginRight="10dp"
12        android:layout_marginTop="15dp"
13        android:background="#F4F4F4">
14
15        <!--Main Body of your custom dialog-->
16    </RelativeLayout>
17
18    <LinearLayout
19        android:id="@+id/llTop"
20        android:layout_width="wrap_content"
21        android:layout_height="wrap_content"
22        android:layout_alignParentRight="true"
23        android:layout_alignParentTop="true"
24        android:orientation="vertical">
25
26        <ImageButton
27            android:id="@+id/btnCancel"
28            android:layout_width="wrap_content"
29            android:layout_height="wrap_content"
30            android:layout_below="@+id/btnBookK"
31            android:background="@null"
32            android:src="@drawable/ic_close" />
33
34    </LinearLayout>
35
36</RelativeLayout>
37