点击一个popupwindow窗口之外的区域popupwindow消失,带来的问题!!

popupwindow窗口之外的区域popupwindow消失 , 以前说过需要设置:

mPopupWindow.setFocusable(true); // 设置PopupWindow可获得焦点
mPopupWindow.setTouchable(true); // 设置PopupWindow可触摸
mPopupWindow.setOutsideTouchable(true); // 设置非PopupWindow区域可触摸
mPopupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.chooseballbg));//
// 这句话必须有,否则
// // 按返回键
// // popwindow不能消失 或者加入这句话
// ColorDrawable dw = new ColorDrawable(-00000);
// mPopupWindow.setBackgroundDrawable(dw);

但是:  加入这些之后,我给Popwindow加了动画的,出现一个恶心的问题:就是popwindow在执行动画过程中,如果Popwindow上有button类似的控件,控件有背景色的变化,就会带来非常恶心的现象: 点击的控件的那一块竟然出现漏洞了,透明的一块,这就是

mPopupWindow.setBackgroundDrawable(getResources().getDrawable(R.drawable.chooseballbg));//

带来的恶果!!  咋办呢?  我这样做的:这句话我不用了!!  用别的方法来实现popwindow的dismiss。

用这种方法:就是利用popwindow内部的空间加入按键事件!!

这样的:

LinearLayout layouttemp = (LinearLayout) view
.findViewById(R.id.linearlayout_blank);
layouttemp.setFocusable(true);
layouttemp.setFocusableInTouchMode(true);
layouttemp.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// 手机键盘上的返回键
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
mPopupWindow.dismiss();
break;
}
return false;
}
});

即可!!

PopuWindow_2的更多相关文章

随机推荐

  1. 复利计算- 结对2.0--复利计算WEB升级版

    客户在大家的引导下,有了更多的想法: 这个数据我经常会填.....帮我预先填上呗?...... 把界面做得简单漂亮好操作一点呗? 能不能帮我转成个APP,我装到手机上就更方便了? 我觉得这个很有用,很 ...

  2. Thinking Clearly about Performance

    http://queue.acm.org/detail.cfm?id=1854041 The July/August issue of acmqueue is out now acmqueue is ...

  3. OC IOS屏幕分辨率

    CGRect screenRect=[UIScreenmainScreen].bounds; CGSize screenSize=screenRect.size; //屏幕分辨率 screenSize ...

  4. 胶囊碰撞体(CapsuleCollider)

    胶囊碰撞体 (Capsule Collider) 胶囊碰撞体 (Capsule Collider) 由两个半球体与一个圆柱体相连接而构成.它与胶囊 (Capsule) 基元形状相同.   一堆胶囊碰撞 ...

  5. html dl dt dd标签元素语法结构与使用

    dl dt dd认识及dl dt dd使用方法 <dl> 标签用于定义列表类型标签. dl dt dd目录 dl dt dd介绍 结构语法 dl dt dd案例 dl dt dd总结 一. ...

  6. 024. asp.net中第一次使用GridView (设置鼠标经过时更换背景色)

    1. 前端HTML代码 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Inde ...

  7. snort-2.9.7.0源码安装过程

    2015/02/15,centos6.5-64-minimal,初始205个包 [root@localhost snort]# yum install wget[root@localhost snor ...

  8. zookeeper启动入口

    最近正在研究zookeeper,一些心得记录一下,如有错误,还请大神指正. zookeeper下载地址:http://zookeeper.apache.org/releases.html,百度一下就能 ...

  9. struts2介绍

    struts2简介 Struts2框架发展 Struts于2000年5月由Craig McClanahan发起,并于 2001年7月发布了1.0版本,Struts一出现便大受欢迎,更成为了以后几年内w ...

  10. Junit手动/自动加载spring配置文件

    分配置文件在classpath下和web-inf下两种情况的加载: ApplicationContext context = new FileSystemXmlApplicationContext(& ...