findViewById(R.id.btn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater layoutInflater=activity.getLayoutInflater();
View view=layoutInflater.inflate(android.R.layout.simple_list_item_1,null);
PopupWindow pw=new PopupWindow(view,100,100);
pw.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.ic_launcher));
pw.setOutsideTouchable(true);
pw.showAtLocation(activity.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
}
});
当然你也可以将自己的控件放入窗体中.