Android开发PopupWindow.showAtLocation用法
来源:互联网 发布:ubuntu kernel 编辑:程序博客网 时间:2024/05/17 22:52
PopupWindow的显示方法有三个:
showAsDropDown(anchor);
showAsDropDown(anchor, xoff, yoff);
showAtLocation(parent, gravity, x, y)。
前两个showAsDropDown方法是让PopupWindow相对于某个控件显示,而showAtLocation是相对于整个窗口的。第一个参数是View类型的parent,虽然这里参数名是parent,其实,不是把PopupWindow放到这个parent里,并不要求这个parent是一个ViewGroup,这个参数名让人误解。官方文档“a parent view to get the android.view.View.getWindowToken() token from
”,这个parent的作用应该是调用其getWindowToken()方法获取窗口的Token,所以,只要是该窗口(父类窗口)上的控件(例如:按钮控件)就可以了。
第二个参数是Gravity,(Gravity.CENTER)可以使用|附加多个属性,如Gravity.LEFT|Gravity.BOTTOM。
第三四个参数是x,y偏移。
1 0
- Android开发PopupWindow showAtLocation用法
- Android开发PopupWindow.showAtLocation用法
- Android开发PopupWindow showAtLocation用法
- Android开发PopupWindow showAtLocation用法
- Android开发PopupWindow.showAtLocation用法
- Android PopupWindow用法(五) showAtLocation
- Android开发之PopupWindow的showAtLocation()和showAsDropDown()
- PopupWindow.showAtLocation理解
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- Android下PopupWindow隐藏及显示(showAtLocation/showAsDropDown)
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- 关于Android popupWindow的位置显示 showAtLocation理解
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- Android PopupWindow怎么合理控制弹出位置(showAtLocation)
- web作用域
- 直接拿来用!最火的Android开源项目(完结篇)
- iOS中AutoLayer自动布局流程及相关方法
- array_multisort对select查询的二维数组排序
- [Erlang]如何添加自己的BIF
- Android开发PopupWindow.showAtLocation用法
- Innodb事务隔离级别
- QT QString字符串转16进制串口发送数据
- 2015.6.5 qt学习笔记 accept()概念
- Unity 5.0 IL2CPP
- iOS动画效果整理
- ASP.NET MVC Bootstrap极速开发框架
- mac终端常用的命令行语句
- Listview部分源码分析