PopupWindow重写返回键
来源:互联网 发布:gta5线上ae86改装数据 编辑:程序博客网 时间:2024/06/05 12:06
重写OnKeyDow配合下面代码,点击物理返回键PopWindow不消失
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); View contentview = inflater.inflate(R.layout.popup, null); contentview.setFocusable(true); // 这个很重要 contentview.setFocusableInTouchMode(true); final PopupWindow popupWindow = new PopupWindow(contentview, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(false);// 这个很重要 popupWindow.setOutsideTouchable(false); contentview.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } return false; } }); popupWindow.showAtLocation(findViewById(android.R.id.content), Gravity.CENTER|Gravity.CENTER_HORIZONTAL, 0, 0);
阅读全文
0 0
- PopupWindow重写返回键
- popupwindow返回键处理
- android PopupWindow 监听返回键,
- 重写返回键
- 重写android返回键
- 重写返回键
- 重写系统返回键
- 重写Android返回键
- Android 重写返回键
- 点击返回键退出popupwindow的方法
- PopupWindow响应返回键的问题
- popupwindow和dialog监听返回键
- popUpWindow响应返回键并关闭
- Android 重写物理返回键
- 安卓重写返回键
- android PopupWindow重写系统菜单
- Android PopupWindow重写系统菜单
- 重写返回键,一次退出应用程序
- Java 加解密技术系列之 RSA
- 桶排序
- 基于WebRTC技术的多人音视频解决方案
- SD卡驱动学习笔记
- 模拟实现字符串函数(续)
- PopupWindow重写返回键
- unix环境高级编程-线程解析
- dependencies与devDependencies之间的区别
- asfasdfasdf
- Centos7之NFS服务器
- PHP——数据库连接(实例)
- xss攻防测试
- AtCoder Grand Contest 018 A
- socket select模型