Try to own Baidu, Mo asked colleagues remember ———— recent sigh, may be too anxious, so later to have the patience to find their own search!!!!
Today is a relatively simple popwindow, pop-up box, this is actually quite simple is mainly a place to compare may be a problem is the Click event
private void Initpopwindow (final TextView Tview) {final string[] name = {"Copy", "Catty", "one", "person", "table", "only", "half", "small", "large", " Two "," half "," pot "," bowl "," pot "," dozen "," bottle "," Cup "," Listen "," jar "," example "," Set "," string "}; View Contentview = Layoutinflater.from (Getactivity ()). Inflate (R.layout.popwindow, NULL); Contentview.setbackgroundcolor (color.white);p Opupwindow = new Popupwindow (Findviewbyid (r.id.fl_layout), 159, 250); Popupwindow.setcontentview (Contentview); TextView TextView = (TextView) Contentview.findviewbyid (R.id.text); Textview.settext ("unit"); ListView ListView = (ListView) Contentview.findviewbyid (R.id.list); arrayadapter<string> adapter = new Arrayadapter<string> (Getactivity (), Android. R.layout.simple_list_item_1, name); Listview.setadapter (adapter);
Popupwindow.setbackgrounddrawable (New paintdrawable ());
<span style= "White-space:pre" ></span>//Get Focus popupwindow.setfocusable (TRUE);
Click on a layout other than Popwindow to let pop disappear popupwindow.setoutsidetouchable (true);
is under which layout (control) under (can modify the upper and lower left and right can) Popupwindow.showasdropdown (Tview);
Monitor Popupwindow missing Popupwindow.setondismisslistener (new Ondismisslistener () {@Overridepublic void Ondismiss () {}}) ; Listview.setonitemclicklistener (New Onitemclicklistener () {@Overridepublic void Onitemclick (adapterview<?> Parent, View view,int position, long id) {mup.setimagedrawable (Getactivity (). Getresources (). Getdrawable ( R.drawable.puj));p Opupwindow.dismiss (); Tview.settext (Name[position]);});
Popwindow, Popup box, Popwindow Click event Conflict problem very good solution