美文网首页
Android PopupWindow常用属性

Android PopupWindow常用属性

作者: 不略 | 来源:发表于2022-08-25 11:39 被阅读0次
    View PopupView = LayoutInflater.from(this).inflate(R.layout.dialog_custom, null);
    PopupWindow CanpopupWindow = new PopupWindow(PopupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    CanpopupWindow.setFocusable(true);//聚焦/解决点击view重新打开popwindow的问题
    CanpopupWindow.setOutsideTouchable(true);//允许点击PopupWindow外部
    CanpopupWindow.setBackgroundDrawable(null);
    CanpopupWindow.setBackgroundDrawable(new ColorDrawable());//不设置背景,下面消失的代码可能不起作用
    CanpopupWindow.showAtLocation(Btnlayout, Gravity.CENTER, 0, -100);//设置显示位置
    

    相关文章

      网友评论

          本文标题:Android PopupWindow常用属性

          本文链接:https://www.haomeiwen.com/subject/wkwagrtx.html