怎么实现让PopupWindow默认为弹出形式???

解决方案 »

  1.   


     public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            LayoutInflater inflate = LayoutInflater.from(this);
            setContentView(R.layout.main);
            mWindow = new PopupWindow(this);
            mWindow.setWidth(WindowManager.LayoutParams.FILL_PARENT);
            mWindow.setHeight(WindowManager.LayoutParams.FILL_PARENT);
            View parent = inflate.inflate(R.layout.main, null);
            mWindow.getMaxAvailableHeight(parent);        mWindow.setTouchable(true);
            mWindow.setFocusable(true);
            inflate = LayoutInflater.from(this);
            mRoot = inflate.inflate(R.layout.popup_window, null);
            mWindow.setContentView(mRoot);
            mWindow.setAnimationStyle(R.style.Animations_PopDownMenu);
        }    public void onImageClick(View v){
            mWindow.showAtLocation(getWindow().getDecorView(), Gravity.NO_GRAVITY, 0, 0);
        }