如何将活动中的值传递给弹出窗口?虽然这似乎是一个愚蠢的问题。代码片段如下所示。我只需要将函数 onButtonPopup() 中的值传递给弹出窗口(shape_details.xml)。提前致谢。
public void onButtonPopup(View target, int position) {
// Make a View from our XML file
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.shape_details, (ViewGroup) findViewById(R.id.llShapeDetails));
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
pw = new PopupWindow(layout, width - width / 4, height - height / 3, true);
pw.setAnimationStyle(R.style.PopupWindowAnimation);
pw.showAtLocation(layout, Gravity.CENTER, 0, 0);
}