一、Xml中
<<span style="color:#000080;font-weight:bold;">TextView
android:text="是否删除"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<<span style="color:#000080;font-weight:bold;">LinearLayout
android:layout_width="200dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<<span style="color:#000080;font-weight:bold;">Button
android:text="删除"
android:layout_width="50dp"
android:layout_height="wrap_content" />
<<span style="color:#000080;font-weight:bold;">Button
android:text="不删除"
android:layout_width="50dp"
android:layout_height="wrap_content" />
</<span style="color:#000080;font-weight:bold;">LinearLayout>
二、Activity里
private void initPPPWindow() {
inflate = LayoutInflater.from(this).inflate(R.layout.item, null);
popupWindow = new PopupWindow(inflate, 200, 200, true);
//设置外边缘点击消失
popupWindow.setOutsideTouchable(true);
//设置点击颜色 与上一行同用
popupWindow.setBackgroundDrawable(new ColorDrawable());
//设置弹窗为于控件的某一处
popupWindow.showAsDropDown(mBtn1,100,100);
popupWindow.showAsDropDown(mBtn2,100,100);
}