Popwindow

popwindow的使用方法

View contentView = LayoutInflater.from(mContext).inflate(
                R.layout.dialog_homelist_view, null);
        mPopupWindow = new PopupWindow(contentView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        Button mPaiPaiBtn = (Button) contentView.findViewById(R.id.paipai_btn);
        Button mAskBtn = (Button) contentView.findViewById(R.id.ask_btn);
        mPaiPaiBtn.setOnClickListener(this);
        mAskBtn.setOnClickListener(this);
        //设置popWindow弹出窗体可点击,这句话必须添加,并且是true
        mPopupWindow.setFocusable(true);
        //设置popwindow如果点击外面区域,便关闭。
        mPopupWindow.setOutsideTouchable(true);
        mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        //设置显示位置
        mPopupWindow.showAsDropDown(mImageButton);
原文地址:https://www.cnblogs.com/suiyilaile/p/5257400.html