protected void Showpopupwindow (view view) {View Popupview = View.inflate (this, r.layout.popupwindow_layout, null); TextView Tv_uninstall = (TextView) Popupview.findviewbyid (R.id.tv_uninstall); TextView Tv_start = (TextView) Popupview.findviewbyid (R.id.tv_start); TextView Tv_share = (TextView) Popupview.findviewbyid (r.id.tv_share); Tv_uninstall.setonclicklistener (this); tv_ Start.setonclicklistener (This), Tv_share.setonclicklistener (this);//Transparent animation (Transparent---> Opaque) alphaanimation Alphaanimation = new Alphaanimation (0, 1); alphaanimation.setduration (+); Alphaanimation.setfillafter (true);// Zoom animation Scaleanimation scaleanimation = new Scaleanimation (0, 1, 0, 1, animation.relative_to_self, 0.5f, animation.relative_ To_self, 0.5f); scaleanimation.setduration (+); Alphaanimation.setfillafter (true);//Animation collection Setanimationset Animationset = new Animationset (true);//Add two animation animationset.addanimation (alphaanimation); animationset.addanimation (scaleanimation);//1, create Form object, specify width Mpopupwindow = new Popupwindow (Popupview, LinearlaYout. Layoutparams.wrap_content, LinearLayout.LayoutParams.WRAP_CONTENT, true);//2, set a transparent background (new colordrawable ()) Mpopupwindow.setbackgrounddrawable (New colordrawable ());//3, specify the form position Mpopupwindow.showasdropdown (view, 50,- View.getheight ());//4,popupview Execution Animation popupview.startanimation (animationset);}
Android phone defender 11--form pop-up Popupwindow