popupWindow 设置指定的出现位置
2016-09-11 15:18
190 查看
我是通过showAtLocation(View parent, int Gravity, int x, int y)这个方法来确定位置的
1.得到指定的view在屏幕上的位置int[] location = new int[2]; //flagView是parent flagView.getLocationOnScreen(location);
2.指定位置(location[0] 和 location[1] 代表了parent左上角点的x、y)
//这个是正下方中间的显示 mPopupWindow.showAtLocation(flagView, Gravity.NO_GRAVITY, location[0] + (rect.width() - windowView.getMeasuredWidth()) / 2, location[1] + rect.height());
相关文章推荐
- android 之popupWindow 在指定位置上的显示
- toolbar中设置menu收起图标颜色以及popupwindow弹出位置
- android 学习之popupWindow 在指定位置上的显示,进出样式。
- 【每天积累一点点】将PopupWindow显示在指定位置
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- Android UI设计--PopupWindow显示位置设置
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- Android中PopupWindow显示在指定位置
- android 之popupWindow 在指定位置上的显示
- android 之popupWindow 在指定位置上的显示
- Android中PopupWindow显示在指定位置
- android 之popupWindow 在指定位置上的显示
- Android之PopupWindow 在指定位置上的显示
- android PopupWindow显示位置设置