PopupWindow|PopupWindow 简单实用(居中显示)

final View inflate = View.inflate(this, R.layout.layout, null); p = new PopupWindow(inflate,100,100); p.setTouchable(true); p.setFocusable(true); p.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.cc))); p.showAtLocation(inflate, Gravity.CENTER,0,0); p.showAsDropDown(inflate,100,100);

    推荐阅读