^

Creating a Pop-Up Dialog

Article 49 in Android-Java

2020-09-02 07:12:25 from bugfish
Creating a Pop-Up Dialog
Android-Java / XML Styling
Last Review on: 2021-05-06 12:24:07 | Hits: 166

Dialog XML File:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"
        tools:ignore="UselessParent">

                <!-- ENTER YOUR ELEMENTS HERE! -->

        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

Code to show Dialog XML in your Activity:

final Dialog dd = new Dialog(ACTIVITY.this);
dd.setTitle("TITLE");
dd.setContentView(R.layout.XMLSHEETABOVE);
// OTHER CODE HERE
dd.show();

If you want to close the Dialog use:

dd.dismiss();

I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
Comment Section
Currently 2 Upvotes!
captcha image

System - 2021-01-12 23:21:57
We appreciate comments on our site!

This Website is using Session Cookies for Site Functionality and AWStats.
Radio