popupwindow显示的位置 布局的右上角,标题栏下
2016-04-26 13:30
513 查看
View popview = View.inflate(activity, R.layout.popwindow_layout, null); int width = Dp2pxUtils.Dp2Px(context, 150f); popupWindow = new PopupWindow(popview, width, LinearLayout.LayoutParams.WRAP_CONTENT); AnimationUtils.showTitlePopWindowAnimation(popview);//给popwindow添加动画 initPopWindowListview(popview); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); View parent = View.inflate(context, R.layout.activity_main_drawerlayout, null); Rect frame = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int x = Dp2pxUtils.Dp2Px(context, 20f); int titleHeight = Dp2pxUtils.Dp2Px(context, 60f); /** * parent:弹窗放置的父布局 * Gravity.TOP + Gravity.RIGHT 该布局的右上角 * x 相对于右上角x方向偏移多少 * fram.top+titleHeight y方向上的偏移值。 */ popupWindow.showAtLocation(parent, Gravity.TOP + Gravity.RIGHT, x, frame.top + titleHeight); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); popupWindow.update(); popOutShadow(popupWindow);//使popwindow以外区域阴影显示
相关文章推荐
- linux awk 内置函数详细介绍(实例)
- linux 数组的初始化和遍历
- Linux nano 命令大全
- linux 更换 软件源后 GPG错误
- linux cat显示若干行
- 用opengl实现轨迹圆|经典程序
- SDUSTOJ 1796 哆啦A梦的军队(线段树维护前缀位置)
- Linux 技巧:让进程在后台可靠运行的几种方法
- Java设计模式(六) Command(命令模式)及Tomcat引申
- 有关Linux下库的概念、生成和升级和使用等
- Zabbix实战笔记
- 怎样使用OpenCV进行人脸识别
- opencv URL
- linux常用信号列表
- 通过nsenter连接docker容器
- Android MVP架构,android-architecture
- Linux fdisk命令参数及用法详解---Linux磁盘分区管理命令fdisk
- OpenCV之基本绘图
- haproxy 访问www.zjdev.com 自动跳转到appserver_8001 对应的nginx
- haproxy 访问www.zjdev.com 自动跳转到appserver_8001 对应的nginx