答案 0 :(得分:0)
首先是PopupWindow,然后在这个PopupWindow上单击TextView,然后显示第二个PopupWindow。
PopupWindow mPop,mPop2;
/**
* show first popupWindow
*/
private void popupWindow(final View vi) {
View view = LayoutInflater.from(this).inflate(R.layout.pop, null);
TextView tv = (TextView) view.findViewById(R.id.tv1);
//click show second one
tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow2(vi);
}
});
if (null == mPop) {
mPop = new PopupWindow(view);
}
mPop.setHeight(294);
mPop.setWidth(200);
mPop.setFocusable(true);
mPop.setOutsideTouchable(true);
mPop.setBackgroundDrawable(new ColorDrawable(0));
mPop.showAtLocation(vi, Gravity.CENTER | Gravity.CENTER, 22,
22);
mPop.update();
}
/**
* show second popupWindow
*/
private void popupWindow2(View v) {
View view = LayoutInflater.from(this).inflate(R.layout.pop2, null);
if (null == mPop2) {
mPop2 = new PopupWindow(view);
}
mPop2.setHeight(294);
mPop2.setWidth(200);
mPop2.setFocusable(true);
mPop2.setOutsideTouchable(true);
mPop2.setBackgroundDrawable(new ColorDrawable(0));
mPop2.showAtLocation(v, Gravity.CENTER | Gravity.CENTER, 42,
42);
mPop2.update();
}