zoukankan      html  css  js  c++  java
  • PopWindow的使用

    方法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();

  • 相关阅读:
    Python之os模块
    Python之加密模块
    Python之random模块
    Python之操作MySQL数据库
    Python之操作Excel
    Jmeter之发送请求入参必须使用编码格式、Jmeter之发送Delete请求可能入参需要使用编码格式
    PAT B1008 数组元素循环右移问题 (20 分)
    PAT B1007 素数对猜想 (20 分)
    PAT B1006 换个格式输出整数 (15 分)
    PAT B1005 继续(3n+1)猜想 (25 分)
  • 原文地址:https://www.cnblogs.com/zhangping/p/3513861.html
Copyright © 2011-2022 走看看