标签:调用 listen ams flat touch data nim 升级 context
final View view = View.inflate(getApplicationContext(), R.layout.layout_popup_window, null); Button btnPupUpdata; Button btnPupExit; Button btnPupCancle; btnPupUpdata = (Button) view.findViewById(R.id.btn_pup_updata); btnPupExit = (Button) view.findViewById(R.id.btn_pup_exit); btnPupCancle = (Button) view.findViewById(R.id.btn_pup_cancle); btnPupUpdata.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this,"您点击了升级",Toast.LENGTH_SHORT).show(); } }); btnPupExit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPopupWindow.dismiss(); } }); mPopupWindow = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); // PopupWindow能响应外部点击事件 mPopupWindow.setOutsideTouchable(true); // PopupWindow能响应点击事件 默认为true // mPopupWindow.setTouchable(false); //设置动画 mPopupWindow.setAnimationStyle(R.style.MyPopuuWindow); // mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { } }); // mPopupWindow.update(); // 显示PopupWindow,其中: // 第一个参数是PopupWindow的锚点,第二和第三个参数分别是PopupWindow相对锚点的x、y偏移 // mPopupWindow.showAsDropDown(anchor, xoff, yoff); // 或者也可以调用此方法显示PopupWindow,其中: // 第一个参数是PopupWindow的父View,第二个参数是PopupWindow相对父View的位置, // 第三和第四个参数分别是PopupWindow相对父View的x、y偏移 mPopupWindow.showAtLocation(llParent, Gravity.BOTTOM, 0, 0); }
标签:调用 listen ams flat touch data nim 升级 context
原文地址:https://www.cnblogs.com/zzl521/p/8908051.html