First show you the effect of the map, we feel satisfied with the results, please refer to the implementation code.
Directly on the code:
private void Setdialog () {View view = Getlayoutinflater (). Inflate (r.layout.dialog_country, null); mdialog = New Dialog (th
IS);
Mdialog.setcontentview (view, New Layoutparams (Layoutparams.fill_parent, layoutparams.wrap_content));
window window = Mdialog.getwindow ();
Windowmanager.layoutparams wl = Window.getattributes ();
wl.x = 0;
Wl.y = Getwindowmanager (). Getdefaultdisplay (). GetHeight ();
Wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
Wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
Mdialog.onwindowattributeschanged (WL);
Mdialog.setcanceledontouchoutside (TRUE);
Mdialog.show ();
Button Btnchina = (button) View.findviewbyid (R.id.btnchina);
Button Btnusa = (button) View.findviewbyid (R.ID.BTNUSA);
Button Btnuk = (button) View.findviewbyid (R.id.btnuk);
Button Btncancel = (button) View.findviewbyid (R.id.btncancel); Btnchina.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {//TODO auto-generated method s Tub Mquery.id (r.id.btncountry). Gettextview (). SetText ("");
Mdialog.dismiss ();
}
}); Btnusa.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {//TODO auto-generated method Stu
b mquery.id (r.id.btncountry). Gettextview (). SetText ("USA");
Mdialog.dismiss ();
}
});
Btnuk.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {//TODO auto-generated method stub
Mquery.id (r.id.btncountry). Gettextview (). SetText ("UK");
Mdialog.dismiss ();
}
}); Btncancel.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {//TODO auto-generated method
Stub Mdialog.dismiss ();
}
}); }
The
First inflate an XML file, produces a view, creates a dialog, sets dialog view as Inflate view, and then sets the length of Windowmanager.layoutparams by Dialog, width, display position, and so on, finally Setcanceledontouchoutside (true), click Elsewhere to exit dialog.