Pages

Subscribe:

Labels

Saturday 8 October 2011

Custom Dialog without border

In order to create the Dialog without border,we need to create the out custom dialog.To create the custom dialog, our class should extend the Dialog class.
See the below example...

MyProgressDialog.java is as follows.


import android.app.Dialog;
import android.content.Context;
import android.view.WindowManager.LayoutParams;
import android.widget.ProgressBar;

public class MyProgressDialog extends Dialog {

    public static MyProgressDialog show(Context context, CharSequence title,
            CharSequence message) {
        return show(context, title, message, false);
    }

    public static MyProgressDialog show(Context context, CharSequence title,
            CharSequence message, boolean indeterminate) {
        return show(context, title, message, indeterminate, false, null);
    }

    public static MyProgressDialog show(Context context, CharSequence title,
            CharSequence message, boolean indeterminate, boolean cancelable) {
        return show(context, title, message, indeterminate, cancelable, null);
    }

    public static MyProgressDialog show(Context context, CharSequence title,
            CharSequence message, boolean indeterminate,
            boolean cancelable, OnCancelListener cancelListener) {
        MyProgressDialog dialog = new MyProgressDialog(context);
        dialog.setTitle(title);
        dialog.setCancelable(cancelable);
        dialog.setOnCancelListener(cancelListener);
        /* The next line will add the ProgressBar to the dialog. */
        dialog.addContentView(new ProgressBar(context), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        dialog.show();

        return dialog;
    }

    public MyProgressDialog(Context context) {
        super(context, R.style.NewDialog);
    }
}



The styles.xml file is as like this

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="NewDialog">
       <item name="android:windowFrame">@null</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowTitleStyle">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
        <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:background">@android:color/transparent</item>
    </style>
</resources>



In the Activity class write like this

MyProgressDialog dialog = new MyProgressDialog(Register.this);
dialog.setContentView(R.layout.pleasewaitpopup);
dialog.show();
                       

 For more information here

20 comments:

Unknown said...

I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.
Android Training institute in chennai with placement | Android Training in chennai

Anonymous said...

Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
Digital Marketing Training in Bangalore

gowsalya said...

I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.
full stack developer training in chennai

Mounika said...

Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
Click here:
python training in Bangalore
Click here:
python training in Bangalore

Unknown said...

It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command

Blue Prism Training in Pune

Blueprism training in tambaram

Blueprism training in annanagar

nilashri said...

The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.

Data Science with Python training in chenni
Data Science training in chennai
Data science training in velachery
Data science training in tambaram
Data Science training in anna nagar
Data Science training in chennai
Data science training in Bangalore

afiah b said...

Read all the information that i've given in above article. It'll give u the whole idea about it.
java training in annanagar | java training in chennai


java training in marathahalli | java training in btm layout

Unknown said...

Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
angularjs-Training in sholinganallur

angularjs-Training in velachery

angularjs Training in bangalore

angularjs Training in bangalore

angularjs Training in btm

priya said...

Excellent blog, I wish to share your post with my folks circle. It’s really helped me a lot, so keep sharing post like this

Microsoft Azure online training
Selenium online training
Java online training
Java Script online training
Share Point online training

Unknown said...

Best devops online training institute.they are giving complete core subject of devops.and i am very thankfull for this institute.

hari said...

good
nice........
inplant training in chennai
inplant training in chennai
online python internship
online web design
online machine learning internship
online internet of things internship
online cloud computing internship
online Robotics
online penetration testing

imexpert said...

Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.

digital marketing courses mumbai

Rashika said...

This is excellent blog!!!

Digital Marketing Training in Chennai | Certification | SEO Training Course | Digital Marketing Training in Bangalore | Certification | SEO Training Course | Digital Marketing Training in Hyderabad | Certification | SEO Training Course | Digital Marketing Training in Coimbatore | Certification | SEO Training Course | Digital Marketing Online Training | Certification | SEO Online Training Course

Anonymous said...

Read all the information that i've given in above article. It'll give u the whole idea about it.
android apps apkzm
android apps apkzm
android apps apkzm
android apps apkzm
android apps apkzm

Rohini said...

Cool stuff you have and you keep overhaul every one of us, Great work. Well done.
pmp course

Rajendra Cholan said...

Python Course in Chennai | Infycle Technologies:

If Python is your dream job, then our Infycle will work with you to realize your dream. Infycle Technologies provides the best Python Chennai courses, with high-demand software courses of various levels such as Java, Python, Hadoop, AWS, etc., in 100% hands-on training by professional instructors in this field. At the same time, pre-interviews will be provided for candidates so that they can fully understand the interview. For more information, please call 7502633633 for more information.
Data science training in Chennai

Rajendra Cholan said...

nfycle Technologies, the top software training institute and placement center in Chennai offers the Digital Marketing course in Chennai for freshers, students, and tech professionals at the best offers. In addition to the Oracle training, other in-demand courses such as DevOps, Data Science, Python, Selenium, Big Data, Java, Power BI, Oracle will also be trained with 100% practical classes. After the completion of training, the trainees will be sent for placement interviews in the top MNC's. Call 7504633633 to get more info and a free demo.
Best software training in chennai

Devi said...

Smart move for your career is Choosing to do Oracle Course in Chennai at Infycle!! Do you know why this name is chosen for Infycle. Infycle where the place we offered Infinity of Oracle.
Yes!!! But not only Oracle, More than 20+ courses are offered here 5000+ students are placed in top MNC’s Company with good salary packages. For admission 7502633633.Oracle Training with Placement | Infycle Technologies

David Fincher said...

This post is so interactive and informative.keep update more information...
RPA Training in Chennai
RPA Training in Chennai

Pavithra Devi said...

Such a good post .thanks for sharing
SEO Training in T Nagar
SEO Training in Chennai

Post a Comment