Thursday, April 17, 2014

android click outside the closed area of ​​the dialog dialog


Ask the experts: If that, I click on the dialog box how to achieve it, as usual logic, if you click outside of the area of ​​the dialog, then the dialog will automatically shut down, and how to achieve it? Consult experts, I am a rookie, online. . .
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Use PopupWindow
Reply:
cited a floor glint reply:
use PopupWindow


With AlertDialog not?
It should be specific with PopupWindow how to use it?
Thank you
Reply:
Talk about my ideas, this can be achieved, I looked at where we are now products on doing, but doing it too much trouble, especially since the definition of the dialog
The whole dialog is set to full screen transparent, view you want to display the dialog box, the dialog is set to touch event handling, and get the current view of the size and coordinates (upper right corner coordinates), compare the current touch point is within the range of view.

Reply:
reference to the third floor majaw reply:
talk about my ideas, this can be achieved, I looked at where we are now products on doing so, make up more trouble, especially since the definition of the dialog
The whole dialog is set to full screen transparent, view you want to display the dialog box, the dialog is set to touch event handling, and get the current view of the size and coordinates (upper right corner coordinates), compare the current touch point is within the range of view.


Dialog can only be done with it? Close the dialog box can be triggered when it loses focus?
Reply:
How no one to answer ah? ?
Or how in the dialog box's title bar to add a close button, just like the pop-up dialog windows as the top right there is a button to close the window
Reply:
The key is not the box, but the box has not been focused, and if it is focused pop, otherwise it can be turned off
Reply:
Try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box is displayed outside the dialog box click
Reply:
reference to the 6th floor lieri111 reply:
key is not box, but the box has not been focused, and if it is focused pop, otherwise it can be turned off


The click of a button and then pop the dialog, you mean when they were focused pop, mouse clicks outside the dialog area is not focused then close it?
Reply:
reference to the 7th floor zuoxima reply:
try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box displays the dialog box click outside


This still does not work ah
Reply:
references, 5th Floor qm2009619 reply:
how no one to answer ah? ?
Or how in the dialog box's title bar to add a close button, just like the pop-up dialog windows as there is a button at the top right to close the window

You mean the upper right corner to close alertdialog? I want to ask you alertdialog are new to still be able to use a more casual
Reply:
reference to the 10th floor majaw reply:
references, 5th Floor qm2009619 reply:

How no one to answer ah? ?
Or how in the dialog box's title bar to add a close button, just like the pop-up dialog windows as the top right there is a button to close the window

You mean the upper right corner to close alertdialog? I want to ask you alertdialog are new to still be able to use a more casual


Well, new to, Oh, not very good yet
Reply:
You can go online to find alertdialog creation, the upper right corner there is a default dialog X, click can turn off alertdialog, came into contact with no need to do so complicated, saw your post on the issue thought you were very familiar to alertdialog the
Reply:
reference to the 12th floor majaw reply:
you can go online to find alertdialog creation, the upper right corner there is a default dialog X, click can turn off alertdialog before they came into contact with no need to do so complicated, saw your post on the issue on alertdialog think you are familiar with the

Ha ha ha, is not familiar to me, but now there is this need to do something, so I ask this question directly. . . .
Top right corner of the default dialog box has a X?
I'm so new AlertDialog.Builder (MyStockActivity.this). Create () in the upper right corner there is no x eh
Reply:
I think that using onKeyDown (); event better, just a thought. .
Reply:
Try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box is displayed outside the dialog box click

What do you use to test a bad phone use? ? I use a samsung phone tests normal way
Reply:
reference to the 14th floor yangmaolinpl reply:
I think that using onKeyDown (); event better, just a thought. .

onKeyDown () instead of pressing the keyboard when the event is triggered it? How to use this one?
Reply:
cited 15 floor yangrunfei reply:
try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box is displayed outside the dialog box click

What do you use to test a bad phone use? ? I use a samsung phone tests normal way

I use the android emulator. . .
alertDialog.setCanceledOnTouchOutside (true) so the list? Ha ha ha, I am a novice. . .
Reply:
protected Dialog onCreateDialog (int id) {
Dialog dd = new AlertDialog.Builder (this). SetTitle ("delete"). SetIcon (
android.R.drawable.ic_dialog_alert). setMessage ("Are you sure you want to delete a contact?")
. SetNegativeButton (android.R.string.cancel, null)
. SetPositiveButton (android.R.string.ok,
new DialogInterface.OnClickListener () {
@ Override
public void onClick (DialogInterface dialog,
int which) {
/ / TODO Auto-generated method stub
delPersion ();
}

.}) Create ();
dd.setCanceledOnTouchOutside (true);
return dd;

}

Yeah, I also use the simulator is to click on the place outside dialg
Reply:
cited 18 floor yangrunfei reply:
protected Dialog onCreateDialog (int id) {
Dialog dd = new AlertDialog.Builder (this). SetTitle ("delete"). SetIcon (
android.R.drawable.ic_dialog_alert). setMessage ("Are you sure you want to delete a contact?")
. SetNegativeButton (android.R ......

Huh. . . I told you about, ah, I was like ah
AlertDialog ad = new AlertDialog.Builder (this) create ();.
ad.setTitle (getString (R.string.choose));
ad.setCanceledOnTouchOutside (true);
ad.setView (textEntryView);
ad.show ();
But this is not my side eh
Reply:
I do not know, me and you change the same, I am fine with,
Reply:
cited 20 floor yangrunfei reply:
do not know, me and you change the same, I am fine with,

Hey strange. . . But thank How about you huh
Reply:
cited 21 floor qm2009619 reply:
cited 20 floor yangrunfei reply:
I do not know, me and you change the same, I am fine with,

Hey strange. . . But thank How about you Oh


I do not work here, because too much dialog, click on the outside did not respond, I get a little small dialog box, on it. . .
Reply:
I realized this, let this dialog has focus, in this dialog box to set the background in showAsDropDown set this popupwindow.setBackgroundDrawable (new BitmapDrawable ()) before () method;
If not, you can add me QQ478319399
Reply:
reference to the 9th floor qm2009619 reply:
reference to the 7th floor zuoxima reply:
Try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box is displayed outside the dialog box click


This still does not work ah

I have a custom DIalog this role
Reply:
Thank you very much, setCanceledOnTouchOutside (true); in the Custom Dialog is available, but require () was registered in the onCreate look
Reply:
reference to the 25th floor of the reply:
Thank you very much, setCanceledOnTouchOutside (true); in the Custom Dialog is available, but requires registration in onCreate () inside look


How to register onCreate () inside ah?
Reply:
http://zhidao.baidu.com/question/462496579.html
Reply:
reference to the 9th floor qm2009619 reply:
reference to the 7th floor zuoxima reply: Try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box is displayed outside the dialog box click

This still does not work ah

Brother, you look at the parameters! Is true, you can change the false, the rookie passing!
Reply:
Try
setCanceledOnTouchOutside (true) ;/ / Cancel dialog box click dialog external display Dialog, this is possible. I have used ah
Reply:
setCanceledOnTouchOutside (true);
Really good with
Reply:
Customize dialog accordance upstairs said method simply does not work
Reply:
setCanceledOnTouchOutside (false); this job, do not use true

Reply:
I just used what should dialog.setCanceledOnTouchOutside (false); Properties dialog box, click outside this will not automatically cancel the dialog

No comments:

Post a Comment