PopupWindow-----点击弹出 PopupWindow 初始化菜单

    /**
     * 点击弹出 PopupWindow  初始化菜单   
     */
    private void initPopupWindow() {
        PopupWindowAdapter adapter = new PopupWindowAdapter();
        mlistView.setAdapter(adapter);     //mlistView  是mPopView 中的listview

// 初始化popwindow , 载入布局文件 if (mPopupWindow == null) { // mPopView view对象xml文件 ,载入到popwindow mPopupWindow = new PopupWindow(mPopView, mTopLayout.getWidth(), //mTopLayout控件的宽 ,mPopView是一个xml LayoutParams.WRAP_CONTENT, true); mPopupWindow.setBackgroundDrawable(new BitmapDrawable()); } if (mPopupWindow.isShowing()) { //开的时候 , 就关闭 mPopupWindow.dismiss(); } else { mPopupWindow.showAsDropDown(mTopLayout, 0, -10); // 设置 ,mTopLayout的下面 } }

 

转载于:https://www.cnblogs.com/java-g/p/4129689.html

你可能感兴趣的:(PopupWindow-----点击弹出 PopupWindow 初始化菜单)