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

效果图:


添加依赖:

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();
<?xml version="1.0" encoding="utf-8"?>
<cn.bingoogolapple.transformerstip.view.TransformersTipLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="vertical"
    app:ad_arrowExtraOffsetX="0dp"
    app:ad_arrowExtraOffsetY="0dp"
    app:ad_arrowGravity="to_top_align_end"
    app:ad_arrowHeight="6dp"
    app:ad_bgColor="#ffffff"
    app:ad_radius="5dp">

    <TextView
        android:id="@+id/tvEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="15dp"
        android:text="编辑分类名称"
        android:textColor="@color/text_3"
        android:textSize="14dp" />

    <View
        android:layout_width="105dp"
        android:layout_height="1dp"
        android:background="@color/assist_e5" />

    <TextView
        android:id="@+id/tvDel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="删除分类"
        android:textColor="@color/text_3"
        android:textSize="14dp" />

    <View
        android:layout_width="105dp"
        android:layout_height="1dp"
        android:background="@color/assist_e5" />

    <TextView
        android:id="@+id/tvDelAll"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="批量移除商品"
        android:textColor="@color/text_3"
        android:textSize="14dp" />

</cn.bingoogolapple.transformerstip.view.TransformersTipLinearLayout>

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值