//create inflater
final LayoutInflater inflater = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//create popupwindow
PopupWindow pw=new PopupWindow(inflater.inflate(R.layout.menu, (ViewGroup)findViewById(R.layout.dictionarylist)));
Button Menu = (Button) findViewById(R.id.Menu);
Menu.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
pw.showAtLocation(v, Gravity.CENTER, 0, 0);
pw.update(0, 0, 200, 250);
pw.setOutsideTouchable(false);
}
});
我想要的是当我单击父活动中的按钮时显示弹出窗口。弹出窗口有按钮,当点击按钮时,它会执行一些功能。