我的popupwindow不知道为什么不响应返回事件
我设置了这些:
popupWindow.setFocusable(true);
popupWindow.setTouchable(true);
popupWindow.setOutsideTouchable(true);还有:popupwindow只能用手机顶部弹出来的么?我想从底部弹出来行不行

解决方案 »

  1.   

        mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {             
                public void onDismiss() {
                    // TODO Auto-generated method stub
                }
            });
    popUpWindow消失后响应
        /**
         * <p>
         * Display the content view in a popup window at the specified location. If the popup window
         * cannot fit on screen, it will be clipped. See {@link android.view.WindowManager.LayoutParams}
         * for more information on how gravity and the x and y parameters are related. Specifying
         * a gravity of {@link android.view.Gravity#NO_GRAVITY} is similar to specifying
         * <code>Gravity.LEFT | Gravity.TOP</code>.
         * </p>
         * 
         * @param parent a parent view to get the {@link android.view.View#getWindowToken()} token from
         * @param gravity the gravity which controls the placement of the popup window
         * @param x the popup's x location offset
         * @param y the popup's y location offset
         */
        public void showAtLocation(View parent, int gravity, int x, int y) {
            showAtLocation(parent.getWindowToken(), gravity, x, y);
        }从SDK内摘录的,可以调整popUpWindow的位置
      

  2.   

    1.PopupWindow本来就不响应back键的操作,Dialog才响应的啊,
    你自己截获back键的事件,如果PopupWindow有show出来,那你就dismiss掉。
    2.PopupWindow弹出来的方向,系统有个默认的弹出动画,你可以自己设定一个动画用来替换。
    好像方法名叫setAnimationStyle()。