Android PopupWindow 问题。
问题描述
需求是点击popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系统均没问题,但是6.0的系统上面点击popupwindow外部以后popupwindow 消失。哪位大佬知道的说下哦。
同时一并问下6.0系统中使用 ContextCompat.checkSelfPermission 同时检查 读,写联系人权限如何实现?
问题解答
回答1:popupWindow.setFocusable(false);popupWindow.setTouchable(true);popupWindow.setBackgroundDrawable(new BitmapDrawable());popupWindow.setOutsideTouchable(false);popupWindow.update();
我试了下,貌似有效果
回答2:When window touchable is true, focusable is false,setOutsideTouchable() works.
pw.setTouchable(true); pw.setFocusable(false); pw.setOutsideTouchable(false);记得给我加分哦!!!thx!回答3:
检查权限:读权限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED;写权限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_CONTACTS) == PackageManager.PERMISSION_GRANTED;判断时添加&&用于判断两个条件是否return true请求权限:第一步:String[] permissions = {Manifest.permission.READ_CONTACTS,Manifest.permission.WRITE_CONTACTS}第二步:ActivityCompat.requestPermissions(activity, permissions,requestCode);
相关文章:
1. dockerfile - [docker build image失败- npm install]2. java - mybatis怎么实现在数据库中有就修改,没有就添加3. docker安装后出现Cannot connect to the Docker daemon.4. docker gitlab 如何git clone?5. javascript - webpack 多入口文件生成HTML文件;6. node.js - mongoDB使用$gte的问题7. nignx - docker内nginx 80端口被占用8. java中关于直接插入排序遇到的问题。9. javascript - npm run build后调用api返回index.html10. docker绑定了nginx端口 外部访问不到
