Android 通用PopupWindow支持从控件的各个位置弹出浮窗

效果图:

Android 通用PopupWindow支持从控件的各个位置弹出浮窗_第1张图片
添加依赖:

implementation 'cn.bingoogolapple:bga-transformerstip-noandroidx:1.0.7@aar'

使用方法:

private TransformersTip transformersTip;

  
  transformersTip = new TransformersTip(v, R.layout.popup_shop_classify_detail) {
            @Override
            protected void initView(View contentView) {
                TextView tvEdit = contentView.findViewById(R.id.tvEdit);
                TextView tvDel = contentView.findViewById(R.id.tvDel);
                TextView tvDelAll = contentView.findViewById(R.id.tvDelAll);
                tvEdit.setVisibility(View.VISIBLE);
                tvDel.setVisibility(View.VISIBLE);
                tvDelAll.setVisibility(View.VISIBLE);
                setPopupClick(tvEdit, tvDel, tvDelAll);
            }
        };
        transformersTip.setShadowColor(Color.parseColor("#ADADAD"));
        transformersTip.setArrowHeightDp(8);
        transformersTip.setTipGravity(TipGravity.TO_BOTTOM_CENTER);
        transformersTip.setTipOffsetXDp(-45);
        transformersTip.setBackgroundDimEnabled(true);
        transformersTip.setDismissOnTouchOutside(true);
        transformersTip.show();


//销毁方法
transformersTip.dismissTip();



    

    

    

    

    

 

你可能感兴趣的:(Android 通用PopupWindow支持从控件的各个位置弹出浮窗)