使用PopWindow时距离边界有间隙的解决办法

转载:https://blog.csdn.net/a15122282003/article/details/54314798

最近发现使用popwindow时有黑色边框

发现是由于继承父类PopWindow的原因,然后便使用了父类的一系列属性

public DevicePopWindow(Context context) {
        super(context);//都是super惹的祸
        View v = LayoutInflater.from(context).inflate(R.layout.left_menu, null);
        RelativeLayout rl_colse = (RelativeLayout) v.findViewById(R.id.rl_colse);
        rl_colse.setAlpha(1f);
        recycler_left_menu = (RecyclerView) v.findViewById(R.id.recycler_left_menu);
        deviceAdapter = new DeviceAdapter(context);
        recycler_left_menu.setLayoutManager(new LinearLayoutManager(context));
        recycler_left_menu.setAdapter(deviceAdapter);
        recycler_left_menu.addItemDecoration(new DividerGridItemDecoration(context,0));
        left_menu_close = (ImageView) v.findViewById(R.id.left_menu_close);
        setListeners();
        setWidth(Utils.dip2px(context, 260));
        setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
        setContentView(v);
    }

删掉 super(context)即可

亲测有效,以此记录!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值