我想要PopupWindow的简单明了的例子(简单如popupMenu) 我想用popupWindow替换popupMenu 请帮忙。
答案 0 :(得分:1)
我解决了这个问题:
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow popup = new PopupWindow(
inflater.inflate(R.layout.popup_window, null, false),
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
true
);
popup.showAtLocation(
findViewById(R.id.main),
Gravity.END | Gravity.TOP,
dpToPx(16),
dpToPx(42)
);