Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
2012-09-18 17:19
239 查看
上一篇对PopupWindow的用法(位置、动画、焦点)做了详细介绍,具体查看Android中PopupWindow的用法(位置、动画、焦点)。下面说说PopupWindow的如何隐藏、显示及显示位置(showAtLocation/showAsDropDown)。
1、PopupWindow的隐藏
2、PopupWindow的显示及位置设置
第一个参数指定PopupWindow的锚点view,即依附在哪个view上。
第二个参数指定起始点为parent的右下角,第三个参数设置以parent的右下角为原点,向左、上各偏移10像素。
如果没有充足的空间显示PopupWindow,那么PopupWindow的左下角将位于anchor的左上角来显示。
转载:http://orgcent.com/category/android/
http://orgcent.com/category/java/
1、PopupWindow的隐藏
final PopupWindow window = mPageStatWin; if(null != window && window.isShowing()) { win.dismiss(); }
2、PopupWindow的显示及位置设置
window.showAtLocation(parent, Gravity.RIGHT | Gravity.BOTTOM, 10,10);
第一个参数指定PopupWindow的锚点view,即依附在哪个view上。
第二个参数指定起始点为parent的右下角,第三个参数设置以parent的右下角为原点,向左、上各偏移10像素。
//将PopupWindow作为anchor的下拉窗口显示。即在anchor的左下角显示 window.showAsDropDown(anchor); //xoff,yoff基于anchor的左下角进行偏移。 window.showAsDropDown(anchor, xoff, yoff);
如果没有充足的空间显示PopupWindow,那么PopupWindow的左下角将位于anchor的左上角来显示。
转载:http://orgcent.com/category/android/
http://orgcent.com/category/java/
相关文章推荐
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- Android编程之PopupWindow隐藏及显示方法示例(showAtLocation,showAsDropDown)
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- Android开发之PopupWindow的showAtLocation()和showAsDropDown()
- 关于Android popupWindow的位置显示 showAtLocation理解
- PopupWindow之showAtLocation,showAsDropDown
- PopupWindow showAtLocation和showAsDropDown参数分析
- showAsDropDown && showAtLocation
- PopupWindow showAtLocation和showAsDropDown参数分析
- 详解Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow用法(二)_showAsDropDown 方法显示的位置
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow用法(五) showAtLocation