80,349
社区成员
发帖
与我相关
我的任务
分享
LayoutInflater layoutInflater=LayoutInflater.from(FlowPurchaseActivity.this);
View popupView=null;
popupView=layoutInflater.inflate(R.layout.activity_flowpurchase_search, null);
popupView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (mPopupWindow != null && mPopupWindow.isShowing()) {
mPopupWindow.dismiss();
mPopupWindow = null;
}
}
});
//popupView.setBackgroundColor(Color.argb(50, 127, 127, 127));
DisplayMetrics dmDisplayMetrics=new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dmDisplayMetrics);
mPopupWindow=new PopupWindow(popupView, dmDisplayMetrics.widthPixels, dmDisplayMetrics.heightPixels);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.setFocusable(true);//这个属性决定gridview能否点击
mPopupWindow.setTouchable(true);
mPopupWindow.update();
mPopupWindow.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(FlowPurchaseActivity.this.getCurrentFocus().getWindowToken()
,InputMethodManager.HIDE_NOT_ALWAYS);
//int flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
//getWindow().addFlags(flags);
}
});