android -- 之PopupWindow的使用

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View contentView = inflater.inflate(R.layout.popwindow, null);
PopupWindow popupWindow = new PopupWindow(contentView,
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
popupWindow.setBackgroundDrawable(MainActivity.this.getResources()
.getDrawable(R.drawable.ic_launcher));
popupWindow.setFocusable(true);

popupWindow.showAsDropDown(v);

原文地址:https://www.cnblogs.com/lzh-Linux/p/4825337.html