PopupWindon实例
2015-07-09 12:59
337 查看
new一个PopupWindown,并指定子view和Popup的宽高,
需要注意的是,如果要给此悬浮窗口设置动画,必须先设置窗口的背景颜色,通常设置成透明
view.getLocationInWindow(location);pw.showAtLocation(view ,Gravity.LEFT|Gravity.TOP, location[0]+DensityUtils.dip2px(AppManager.this, 40), location[1]);v.startAnimation(sc);
需要注意的是,如果要给此悬浮窗口设置动画,必须先设置窗口的背景颜色,通常设置成透明
View v=View.inflate(AppManager.this, R.layout.activity_main_applicationmaneger_popup, null); ScaleAnimation sc=new ScaleAnimation(0, 1, 0.5f, 1, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, .05f); sc.setDuration(300);
<span style="white-space:pre"> </span> pw=new PopupWindow(v,-2,-2); pw.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
<span style="white-space:pre"> </span>
<span style="white-space:pre"> </span><pre name="code" class="java"><span style="white-space:pre"> </span>//用来存储被点击的控件的位置 int [] location =new int [2];
view.getLocationInWindow(location);pw.showAtLocation(view ,Gravity.LEFT|Gravity.TOP, location[0]+DensityUtils.dip2px(AppManager.this, 40), location[1]);v.startAnimation(sc);
相关文章推荐
- codeforces 339D Xenia and Bit Operations 线段树
- linux(Centos)下编译安装gcc4.8.2
- linux下编译安装boost库
- ffmpeg解码+opencv显示
- Linux的s、t、i、a权限
- SharePoint自动化系列——Set MMS field value using PowerShell.
- 细说Linux系统优化
- Emgucv传递Image类参数给Opencv的Mat类
- windows下使用xShell向远程linux上传文件
- setsockopt()用法(参数详细说明)
- 如何加入该网站for Linux(绑定域名)
- linux下安装gsoap
- linux awk命令详解
- linux 全盘搜索
- Openfire 性能优化
- 网站设计,你需要注意什么?
- Linux下安装禅道管理系统7.2
- OpenCV3.0.0API文档中英文对照
- tar,tar.gz,zip,tar.bz2压缩算法比较,tar.bz2压缩率最大最耗cpu
- AccessController.doPrivileged