创建一个popUpWindow

    /**
     * 购物车对话框
     */
    private void showPoppupWindow() {
        View cart_data_view = LayoutInflater.from(HDJHomePageActivity.this).inflate(R.layout.hdj_vege_fruits_pop, null);
        pop_listview = (ListView) cart_data_view.findViewById(R.id.hdj_vf_pop_view);
        ImageView canclePop = (ImageView) cart_data_view.findViewById(R.id.hdj_gouwuche_cancle);
        okPop = (TextView) cart_data_view.findViewById(R.id.hdj_gouwuche_ok);
        priceSumTxt = (TextView) cart_data_view.findViewById(R.id.hdj_gouwuche_priceSum);
        pop_listview.setSelector(new ColorDrawable(Color.TRANSPARENT));
        xianshiChae();
        popListviewAdapter = new HDJCartPopListviewAdapter(HDJHomePageActivity.this, HDJHomePageActivity.this);
        pop_listview.setAdapter(popListviewAdapter);
        String priceNum = String.format(getResources().getString(com.jminhui.cshop.R.string.product_price), Float.valueOf(""+gouwuCheZongjia()));
        priceSumTxt.setText(""+String.valueOf(priceNum));
        popListviewAdapter.setData(mProducts);
//        fujinAdapter = new NSPopFujinListviewAdapter(HDJVegetableFruitActivity.this);
//        pop_listview.setAdapter(fujinAdapter);
//        fujinAdapter.setList(near);
//        int height=  this.getWindowManager().getDefaultDisplay().getHeight();
//        popupWindow = new PopupWindow(cart_data_view, LinearLayout.LayoutParams.MATCH_PARENT, height*6/10, true);
        popupWindow = new PopupWindow(cart_data_view, LinearLayout.LayoutParams.MATCH_PARENT,  LinearLayout.LayoutParams.WRAP_CONTENT, true);

        popupWindow.setTouchable(true);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setBackgroundDrawable(new BitmapDrawable(getResources(), (Bitmap) null));
        //设置SelectPicPopupWindow弹出窗体的背景
        ColorDrawable dw = new ColorDrawable(Color.WHITE);
        popupWindow.setBackgroundDrawable(dw);
//        popupWindow.showAsDropDown(fujin, 0, 0);
        popupWindow.showAtLocation(HDJHomePageActivity.this.findViewById(R.id.hdj_home_rela), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
        //设置背景颜色变暗
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = 0.7f;
        getWindow().setAttributes(lp);
        countItemHight();
        popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                WindowManager.LayoutParams lp = getWindow().getAttributes();
                lp.alpha = 1f;
                getWindow().setAttributes(lp);
//                fujin_icon.setImageDrawable(getResources().getDrawable(R.drawable.ns_icon_jiantou_down));
            }
        });
        canclePop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                popupWindow.dismiss();
            }
        });
        okPop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(gouwuCheZongjia()>=Double.parseDouble(homeModel.getStart_price())) {
                    ArrayList<String> productIds = new ArrayList<String>();
                    ArrayList<String> productNums = new ArrayList<String>();
                    ArrayList<String> productPrice = new ArrayList<String>();
                    ArrayList<String> productName = new ArrayList<String>();
                    for (int i = 0; i < mProducts.size(); i++) {
                        productIds.add(mProducts.get(i).getId());
                        productNums.add(mProducts.get(i).getNumber() + "");
                        productPrice.add(mProducts.get(i).getGood_price());
                        productName.add(mProducts.get(i).getGood_name());
                    }
                    Intent intent = new Intent(HDJHomePageActivity.this, OSPCommitOrderActivity_.class);
                    intent.putStringArrayListExtra("productIds", productIds);
                    intent.putStringArrayListExtra("productNums", productNums);
                    intent.putStringArrayListExtra("productPrice", productPrice);
                    intent.putStringArrayListExtra("productName", productName);

                    intent.putExtra("market_id", mProducts.get(0).getMarket_id());
                    intent.putExtra("market_name", shopName);
                    intent.putExtra("info", new OSPShopCartInfo.InfoBean());
                    startActivity(intent);
                }
            }
        });
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值