コード例 #1
0
 @Override
 protected void onDestroy() {
   MyApplication.removeAct(this);
   super.onDestroy();
   if (popup != null && popup.isShowing()) {
     popup.dismiss();
   }
 }
コード例 #2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (user == null) {
     user = new User();
   }
   popup = new PopupWindow(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
   // 若popup未设置Backgroud会导致在点击其它地方时popup不自动收起
   popup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
   popup.setFocusable(true);
   MyApplication.addAct(this);
 }