读书人

PopupWindow的施用

发布时间: 2012-09-03 09:48:39 作者: rapoo

PopupWindow的使用

View pview = inflater.inflate(R.layout.popup_example,(ViewGroup)findViewById(R.layout.main));?
PopupWindow pw = new PopupWindow(pview);?
? ? ? ? ? ? pw.showAtLocation(v, Gravity.LEFT,0,0);?
? ? ? ? ? ? pw.update(8,-70,150,270);?
?
? ? ? ? ? ? ? //if onclick written here, it gives null pointer exception.?
? ? ? ? ? ? ImageButton img=(ImageButton)pview.findViewById(R.id.home);?
? ? ? ? ? ? img.setOnClickListener(new OnClickListener()?
? ? ? ? ? ? {?
? ? ? ? ? ? ? ? public void onClick(View v)?
? ? ? ? ? ? ? ? {?
? ? ? ? ? ? ? ? ? ? Intent.....?
? ? ? ? ? ? ? ? }?
? ? ? ? });?

读书人网 >移动开发

热点推荐