1、PopupWindow的显示及位置设置
window.
第一个参数指定PopupWindow的anchor(锚点)view,即依附在哪个view上。第二个参数指定起始点为parent的右下角,第三个参数设置以parent的右下角为原点,向左、上各偏移10像素。
//将PopupWindow作为anchor的下拉窗口显示。即在anchor的左下角显示window.//xoff,yoff基于anchor的左下角进行偏移。window.
补充
anchor.getLocationOnScreen(location);Rect anchorRect = new Rect(location[0], location[1],
location[0] + anchor.getWidth(),location[1] + anchor.getHeight());
Rect是矩形区域,四个分别为左上右下的坐标。
,学习会使你永远立于不败之地。