zoukankan      html  css  js  c++  java
  • popupwindow显示的位置 布局的右上角,标题栏下

    View popview = View.inflate(activity, R.layout.popwindow_layout, null);
            int width = Dp2pxUtils.Dp2Px(context, 150f);
            popupWindow = new PopupWindow(popview, width, LinearLayout.LayoutParams.WRAP_CONTENT);
            AnimationUtils.showTitlePopWindowAnimation(popview);//给popwindow添加动画
            initPopWindowListview(popview);
            popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            View parent = View.inflate(context, R.layout.activity_main_drawerlayout, null);
            Rect frame = new Rect();
            activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
            int x = Dp2pxUtils.Dp2Px(context, 20f);
            int titleHeight = Dp2pxUtils.Dp2Px(context, 60f);
            /**
             * parent:弹窗放置的父布局
             * Gravity.TOP + Gravity.RIGHT  该布局的右上角
             * x   相对于右上角x方向偏移多少
             * fram.top+titleHeight  y方向上的偏移值。
             */
            popupWindow.showAtLocation(parent, Gravity.TOP + Gravity.RIGHT, x, frame.top + titleHeight);
            popupWindow.setOutsideTouchable(true);
            popupWindow.setFocusable(true);
            popupWindow.update();
            popOutShadow(popupWindow);//使popwindow以外区域阴影显示

  • 相关阅读:
    tomcat常见报错解决方法汇总
    C++中socket编程
    Winsock解析
    等价类划分的原则
    在线编译器
    条件覆盖,路径覆盖,语句覆盖,分支覆盖解释
    并发测试
    针对C程序员的 C++
    缸中之脑
    什么是薛定谔的猫
  • 原文地址:https://www.cnblogs.com/epmouse/p/5434756.html
Copyright © 2011-2022 走看看