With Alertdialog.builder, you can also customize your own dialog. But if there is edittext in dialog, you will find that clicking on the EditText system may not eject the soft keyboard. This problem does not occur when you use the inherited dialog method. Custom Dialog Sampl
Today, a custom AlertDialog dialog box is created. It is normal when you click it for the first time, but an error occurs during the second call: java. lang. illegalStateException: The specified child already has a parent. you must call removeView () on the child's parent first.
The error code is:
[Java]// Window ConstructorSynchronized protected View GetTextEntryView (){LayoutInflater inflater = (LayoutIn
Custom exit pop-up boxes are not very common in applications. We often see them in games. Next, let's take a look at how it is implemented. First, we define a method to call this method when the user clicks to exit.
1 Private Void Dialog (){ 2 Final Alertdialog DLG = New Alertdialog. Builder ( This ). Create (); 3 DLG. Show (); 4 Window window = DLG. getwindow (); 5 Window. setcon
-generated Method Stub}});}private void init () {TODO auto-generated Method Stub//Get down the Marquee objectSpyear = (Spinner) Findviewbyid (r.id.spyears);//Get Adapter ObjectThe first parameter is the activity object where the layout is to be displayed, the second parameter is the physical address of the collection data to be displayed, and the third parameter isrefers to the appropriate layout page, where Android comes directly with the layoutArray
Custom network loading dialog box, custom loading dialog box
When the App interacts with the server over the network, a prompt loading box is required. In this case, you can customize a dialog box for loading. The Code is as follows:
Public class LoadingDialog extends
Tags: text version pretty target OGR layout use base extAlertdialog, ProgressDialog implementation of the Single-selection dialog box, multi-Select dialog box, progress Bar dialog box, Input Box dialog box Pre-stated: dialog box should choose Android.support.v7 This package
It's okay, just write a dialog box about the custom dialog box and use handler and timertask to regularly update the data of its custom dialog box. Because the custom dialog box is impl
Tags: Android style blog HTTP color Io AR for strong
Inside res/style.xmlInside anim/fadein.xmlInside anim/fadeut.xmlMainActivityDialog imageDiaglog= new Dialog(MainActivity.this,R.style.PauseDialog);
Http://stackoverflow.com/questions/4817014/animate-a-custom-dialog
The windowEnterAnimation is one of my animation
Android can create three kinds of dialog boxes, OK Cancel dialog box, Radio dialog box, multiple selection dialog box
The OK Cancel dialog box Demo example in Android
Demo case usin
(DialogInterface dialog, int which ){Dialog. dismiss ();}}). SetNegativeButton ("cancel", null). show ();
Figure 6 effect:Information Content is a set of simple list items
New AlertDialog. Builder (this). setTitle ("list box"). setItems (New String [] {"Item1", "Item2"}, null). setNegativeButton ("OK", null). show ();
Figure 7 effect:Information Content is a custom
. ic_dialog_info ). setsinglechoiceitems ( New String [] {"Item1", "item2"}, 0, New dialoginterface. onclicklistener () { Public void onclick (dialoginterface dialog, int which) { dialog. dismiss (); } }). setnegativebutton ("cancel", null ). show ();
Figure 6 effect:Information Content is a set of simple list items
New alertdialog. Builder (this). settitle ("list box"). setitems (New Strin
5 Effect: Information content is a set of multiple-selection boxes
New Alertdialog.builder (this). Settitle ("Radio Box"). SetIcon (
android. R.drawable.ic_dialog_info). Setsinglechoiceitems (
new string[] {"Item1", "Item2"}, 0,
New Dialoginterface.onclicklistener () {public
void OnClick (dialoginterface dialog, int which) {
Dialog.dismiss ();
}
}). Setnegativebutton ("Cancel"
). Setsinglechoiceitems (New string[] {"Item1", "Item2"}, 0,New Dialoginterface.onclicklistener () {public void OnClick (Dialoginterface dialog, int which) {Dialog.dismiss ();}}). Setnegativebutton ("Cancel", null). Show ();Figure 6 Effect: information content is a set of simple list itemsNew Alertdialog.builder (this). Settitle ("list box"). Setitems (New string[] {"Item1", "Item2"}, NULL). Setnegativebutton (OK, null). Show ();Figure 7 Effect: infor
). Setsinglechoiceitems (New string[] {"Item1", "Item2"}, 0,New Dialoginterface.onclicklistener () {public void OnClick (Dialoginterface dialog, int which) {Dialog.dismiss ();}}). Setnegativebutton ("Cancel", null). Show ();Figure 6 Effect: information content is a set of simple list itemsNew Alertdialog.builder (this). Settitle ("list box"). Setitems (New string[] {"Item1", "Item2"}, NULL). Setnegativebutton (OK, null). Show ();Figure 7 Effect: infor
TextView TV _my_camera_from_album; private Context mContext; private static int mTheme = R. style. myDialog;/*** custom Dialog ** @ param context * @ param activity * The Activity where the Dialog is located, click "OK" and finish the text on the Activity * @ param title * text content * @ param btnString * button * @ param theme * style */public MyCameraDialog
). Setsinglechoiceitems ( new string[] {"Item1", "Item2"}, 0, New Dialoginterface.onclicklistener () { publicvoidint which) { Dialog.dismiss (); } }). Setnegativebutton (null). Show ();Figure 6Figure 6 Effect: Information content is a set of simple list items New Alertdialog.builder (this). Settitle ("list box"). Setitems ( newnull). Setnegativebutton ( null). Show ();Figure 7Figure 7 Effect: Information content is a customized layout1. layout FilesAndroid:
Android learning-common android pop-up dialog box and android pop-up dialog box
When we do development at ordinary times, we will inevitably use a variety of dialogs. I believe that anyone who has experience developing other platforms will know that most of the platforms onl
windowmanager.layoutparams mparams = Window.getattributes ();
Mparams.width = Android.view.WindowManager.LayoutParams.MATCH_PARENT;
Mparams.height = Android.view.WindowManager.LayoutParams.WRAP_CONTENT;
Window.setgravity (Gravity.bottom); Here you can set the location of the dialog display
window.setattributes (mparams);
The Third Way: SetLayout ()
The specific code is as follows:
View view = Getlayoutinflater
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.