Java note Wrapping written in <P/> or <BR/>
Spaces written in
Such as:
/**
* Pop-up Operation confirmation dialog box, pop-up confirmation box is divided into two parts, above is a string of prompt text, the following has about two action buttons <BR/>
*-------------------------------<BR/>
* | & nbsp; & nbsp; & Nbsp; |<br/>
* | & nbsp; & nbsp; & Nbsp; |<br/>
* | hint Message |<BR/>
* | & nbsp; & nbsp; & Nbsp; |<br/>
* | & nbsp; & nbsp; & Nbsp; |<br/>
* |------------------------------|<br/>
* | & nbsp; | |<BR/>
* | left button & nbsp;| Right Button |<BR/>
* | & nbsp; | |<BR/>
* -------------------------------
*
* @param msgtxt displayed on the dialog message
* @param leftbuttontxt The display text of the lower left operation button
* @param rightbuttontxt The display text of the lower right action button
* @param leftbuttonlistener to the lower left operation button Click Callback
* @param rightbuttonlistener to the right hand button to click the callback <BR/>
*/
private void Showconfirmdialog (String msgtxt, String leftbuttontxt, String rightbuttontxt, Final Onclicklistener Leftbuttonlistener, Final Onclicklistener Rightbuttonlistener) {
Final Dialog Dialog = new Dialog (this,r.style.pospassportdialog);
Dialog.setcanceledontouchoutside (FALSE);
Dialog.setcontentview (R.layout.dialog_confirm_no_title);
Layoutparams LP = Dialog.getwindow (). GetAttributes ();
Lp.height = Getresources (). Getdisplaymetrics (). Heightpixels/3;
Dialog.getwindow (). SetAttributes (LP);
Cue message for window display
TextView tv_msg = (TextView) Dialog.findviewbyid (r.id.tv_msg);
Tv_msg.settext (MsgTxt);
Processing of the left button
Final Button LeftButton = (Button) Dialog.findviewbyid (R.id.left_button);
Leftbutton.settext (Leftbuttontxt);
Leftbutton.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View v) {
if (Leftbuttonlistener!=null) {
Leftbuttonlistener.onclick (LeftButton);
}
Dialog.cancel ();
}
});
Right button handling
Final Button Rightbutton = (Button) Dialog.findviewbyid (R.id.right_button);
Rightbutton.settext (Rightbuttontxt);
Rightbutton.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View v) {
if (Rightbuttonlistener!= null) {
Rightbuttonlistener.onclick (Rightbutton);
}
Dialog.cancel ();
}
});
Dialog.show ();
}
The effect displayed: