方法1:
public
PopupWindow pop=null;
public View pop_view;
--------------------
pop_view
= getLayoutInflater().inflate(R.layout.list_pop, null,false);
pop=
new
PopupWindow(pop_view,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,true);
popupWindow.setBackgroundDrawable(new
BitmapDrawable());
lv_client_droplist = (ListView)
popupWindow_view.findViewById(R.id.lv_client_droplist);
//popupWindow.showAtLocation(findViewById(R.id.parent),
Gravity.CENTER| Gravity.CENTER, 0, 0);
--------------------
private void dismissPopupWindow()
{
if (popwindow != null &&
popwindows.isShowing()) {
popwindow.dismiss();
popwindow =
null;
}
}
@Override
protected void onDestroy()
{
super.onDestroy();
dismissPopupWindow();
}
------------------------------------------------------------------------------
注意:
pop= new
PopupWindow(pop_view,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,true);
可以换为:
pop= new
PopupWindow(pop_view,-2,-2,true);
popupWindow.dismiss()方法只能关闭显示的窗口并不能释放内存,所以每show一次内存一直在增加。
-------------------------------------------------------------------------------
方法2:
private
PopupWindow popwindow;
private View
pop_view;
---------------
pop_view.setFocusable(true); //锁定后面界面
popwindow = new PopupWindow(pop_view,-2,-2,true);
popwindow.setAnimationStyle(R.style.PopupAnimation);
popwindow.setBackgroundDrawable(new BitmapDrawable());
popwindow.showAtLocation(findViewById(R.id.parent), Gravity.LEFT|
Gravity.TOP, 10, 50);
popwindow.update();
相关文章
- 09-26松鼠的新家 - LCA/树剖/树的查分
- 09-26setFocus一定要写在setLayout设置的后面,否则不起作用——使用setFocusPolicy为控件设置不同的焦点策略:Tab焦点,Click焦点,Wheel焦点和没有焦点
- 09-26leetcode 235.二叉搜索树的最近公共祖先
- 09-26使用NPOI和线程池快速加载EXCEL数据
- 09-26Winform使用DevExpress的WaitDialogForm画面 z
- 09-26vivado/FPGA 使用小纪
- 09-26【LCA+树上差分】P3258 [JLOI2014] 松鼠的新家
- 09-26第四章 字符串的练习(1.5)
- 09-26WinForm中,设置不显示窗口的标题栏
- 09-26BF16是为深度学习而优化的新数字格式 预测精度的降低幅度最小