This note records a week of small knowledge points and some heart-learning demos.
1.PopupWindow:
New a activity_pop_window:id for Popwindow button,id for hello123 TextView
Self-Test 2.3 below cannot be achieved:
1 protected voidonCreate (Bundle savedinstancestate) {2 Super. OnCreate (savedinstancestate);3 Setcontentview (R.layout.activity_pop_window);4Button BTN =(Button) Findviewbyid (R.id.popwindow);5 FinalView view =Layoutinflater.from (Getapplicationcontext ()). Inflate (6R.layout.popwindoview,NULL);7 FinalPopupwindow pop =NewPopupwindow (200, 200);8 View.findviewbyid (r.id.hello123). Setonclicklistener (9 NewOnclicklistener () {Ten One @Override A Public voidOnClick (View v) { - Pop.dismiss (); - } the }); - Pop.setcontentview (view); -Btn.setonclicklistener (NewOnclicklistener () { - + @Override - Public voidOnClick (View v) { + //Pop.showasdropdown (v); A int[] pos =New int[2]; at V.getlocationonscreen (POS); -Pop.showatlocation (V, gravity.no_gravity, Pos[0], pos[1]); - } - }); -}
The disappearance of 2.PopupWindow
Method 1: By clicking Event Onclicklistrener
Method 2: Set the Popupwindow parameter:
Pop.setoutsidetouchable (TRUE);
Pop.setfocusable (TRUE);
Android Week notes (9.8-14) (continuous update)