Android mobile guard 11 -- pop-up PopupWindow, 11 -- popupwindow
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); listener (this); TV _start.setOnClickListener (this); TV _share.setOnClickListener (this); // transparent animation (transparent ---> opaque) AlphaAnimation alphaAnimation = new AlphaAnimation (0, 1 ); alphaAnimation. setDuration (1000); alphaAnimation. setFillAfter (true); // scaling Animation ScaleAnimation scaleAnimation = new ScaleAnimation (0, 1, 0, 1, Animation. RELATIVE_TO_SELF, 0.5f, Animation. RELATIVE_TO_SELF, 0.5f); scaleAnimation. setDuration (1000); alphaAnimation. setFillAfter (true); // The animation set SetAnimationSet animationSet = new AnimationSet (true); // Add two animations, animationSet. addAnimation (alphaAnimation); animationSet. addAnimation (scaleAnimation); // 1, create a form object, specify the width and height of 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 executes the animation popupView. startAnimation (animationSet );}