<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/window" >

    <RelativeLayout
        android:id="@+id/layout_title"
        android:layout_width="match_parent"
        android:layout_height="@dimen/item_height">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:layout_marginLeft="20dp"
            android:gravity="center_vertical"
            android:text="@android:string/dialog_alert_title"
            android:textAppearance="@style/TextAppearance.AppCompat.Title"
            android:textColor="@color/item_title"/>

        <ImageButton
            android:id="@+id/close"
            android:layout_width="@dimen/item_height"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:layout_marginRight="10dp"
            android:background="@android:color/transparent"
            app:srcCompat="@drawable/ic_close_black_24dp"/>
    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:layout_below="@id/layout_title"
        android:layout_centerVertical="true"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:layout_marginBottom="5dp"
            android:minWidth="200dp"
            android:orientation="horizontal" >

            <ProgressBar
                android:id="@+id/pb1"
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="@dimen/button_width_small"
                android:layout_height="@dimen/button_width_small"
                android:layout_marginLeft="10dp"
                android:layout_gravity="center_vertical"
                android:visibility="gone"
                tools:visibility="visible"/>

            <TextView
                android:id="@+id/text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="left|center_vertical"
                android:layout_marginLeft="10dp"
                android:minLines="1"
                android:gravity="left|center_vertical"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                android:textColor="@color/holo_blue_bright"
                android:visibility="gone"
                tools:text="hello"
                tools:visibility="visible"/>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/layout_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|bottom"
            android:orientation="horizontal"
            android:paddingTop="10dp">

            <FrameLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <Button
                    android:id="@+id/button_ok"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:background="@drawable/button_bg"
                    android:text="@android:string/ok"
                    android:visibility="gone"
                    android:textColor="@android:color/white"
                    tools:visibility="visible"/>
            </FrameLayout>

            <FrameLayout
                android:id="@+id/layout_cancel"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:visibility="gone"
                tools:visibility="visible">

                <Button
                    android:id="@+id/button_cancel"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:background="@drawable/button_bg"
                    android:text="@android:string/cancel"
                    android:textColor="@android:color/white"
                    android:visibility="gone"
                    tools:visibility="visible"/>
            </FrameLayout>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>