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);