Android PopupWindow 問題。
問題描述
需求是點擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統(tǒng)均沒問題,但是6.0的系統(tǒng)上面點擊popupwindow外部以后popupwindow 消失。哪位大佬知道的說下哦。
同時一并問下6.0系統(tǒng)中使用 ContextCompat.checkSelfPermission 同時檢查 讀,寫聯(lián)系人權限如何實現(xiàn)?
問題解答
回答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. python 利用subprocess庫調用mplayer時發(fā)生錯誤2. python文檔怎么查看?3. python - Pycharm的Debug用不了4. javascript - 關于apply()與call()的問題5. datetime - Python如何獲取當前時間6. javascript - nginx反向代理靜態(tài)資源403錯誤?7. html - eclipse 標簽錯誤8. 請問PHPstudy中的數(shù)據(jù)庫如何創(chuàng)建索引9. 安全性測試 - nodejs中如何防m(xù)ySQL注入10. python - pycharm 自動刪除行尾空格
