View inflate1 = LayoutInflater.from(Main2Activity.this).inflate(R.layout.pop, null); PopupWindow popupWindow=new PopupWindow(inflate1, ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT,true); popupWindow.setTouchable(true); popupWindow.setBackgroundDrawable(new ColorDrawable(0x000000)); popupWindow.showAtLocation(inflate1, Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL,0,0);
转载于:https://my.oschina.net/u/3709181/blog/1557218