创建一个类,继承PopupWindow

public class Solve7PopupWindow extends PopupWindow {    public Solve7PopupWindow(View mMenuView, int matchParent, int matchParent1) {        super(mMenuView, matchParent,matchParent1);    }    @Override    public void showAsDropDown(View anchor) {        if (Build.VERSION.SDK_INT == 24) {            Rect rect = new Rect();            anchor.getGlobalVisibleRect(rect);            int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom;            setHeight(h);        }        super.showAsDropDown(anchor);    }}
在new出来即可使用 
centerView是你自己想要将popupWindow显示的在这个view的下面
   
mMenuPopupWindow = new Solve7PopupWindow(mMenuView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
mMenuPopupWindow.showAsDropDown(centerView);;

更多相关文章

  1. android -------- 混淆打包报错(warning - InnerClass annotatio
  2. Android开发环境配置
  3. Android(安卓)GoogleMap Overlay (图层标记)
  4. Android外接扫码枪监听普通输入事件
  5. Android入门:Button
  6. 解决Conversion to Dalvik format failed with error 1
  7. unity3d IL2CPP for android
  8. Android之应用程序监听开机启动自启动应用程序
  9. android 报错问题解析

随机推荐

  1. Android系统数据传递机制
  2. 使用Android(安卓)隐藏API和内部 API
  3. 命令行开发、编译、打包Android应用程序
  4. android EditText基本设置
  5. android布局中的基本属性:
  6. Android(安卓)NDK 编程环境搭建
  7. [置顶] Android常用适配器控件
  8. android监听软键盘+吐槽!
  9. Android输入子系统之InputReader读取键盘
  10. -----------Android Support v4、v7、v13