btn implements OnClickListener{
@override
public void onClick(View v){
popAwindow(v);
}
}
protected boolean popAwindow(View view){
if (window == null) {
LayoutInflater lay = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = lay.inflate(R.layout.popupwindo, null);
popupTextContent = (TextView) v.findViewById(R.id.tip);
textcontent = (TextView) v.findViewById(R.id.textcontent);
window = new PopupWindow(v, 500, 500);
}
popupTextContent.setText(textContent[mNum]);
window.setFocusable(true);
window.setOutsideTouchable(true);/点击window外部可以取消window
window.setBackgroundDrawable(new BitmapDrawable());
window.update();
window.showAtLocation(view, Gravity.CENTER_VERTICAL, 0, 0);
return true;
}